Python iso8601 东八区时间

Posted by wxianfeng Wed, 28 May 2014 07:40:00 GMT
import datetime
import pytz

dt =
print(dt)  # 2013-12-04 15:38:58.910402 本地时间,不带时区
pst = pytz.timezone('Asia/Shanghai')
dt = pst.localize(dt)
print(dt)  # 2013-12-04 15:38:58.910402+08:00

This entry was posted on Wed, 28 May 2014 07:40:00 GMT and Posted in . You can follow any any response to this entry through the Atom feed. You can leave a comment or a trackback from your own site.

Tags ,


Use the following link to trackback from your own site:


Leave a comment