擅长:python、mysql、java
<p>使用<code>cst.localize</code>将原始日期时间设置为可识别时区的日期时间。</p>
<p>然后使用<code>astimezone</code>将支持时区的日期时间转换为另一个时区。</p>
<pre><code>import pytz
import datetime
est = pytz.timezone('US/Eastern')
cst = pytz.timezone('US/Central')
curtime = cst.localize(datetime.datetime.now())
curtime = curtime.astimezone(est)
</code></pre>