import pytz
from django.conf import settings
tz = pytz.timezone(settings.TIME_ZONE)
tz.localize(datetime.datetime(2015, 5, 8 , 15, 31)) 构建时间对象时用此方法
结果: datetime.datetime(2015, 5, 8, 15, 31, tzinfo=<DstTzInfo 'Asia/Shanghai' CST+8:00:00 STD>)
CST就是Central Standard Time的意思
datetime.datetime(2014,7,29, tzinfo=tz)
结果:datetime.datetime(2015, 5, 8, 15, 31, tzinfo=<DstTzInfo 'Asia/Shanghai' LMT+8:06:00 STD>)
LMT,这是Local Mean Time的缩写,是本地平均时
from django.conf import settings
tz = pytz.timezone(settings.TIME_ZONE)
tz.localize(datetime.datetime(2015, 5, 8 , 15, 31)) 构建时间对象时用此方法
结果: datetime.datetime(2015, 5, 8, 15, 31, tzinfo=<DstTzInfo 'Asia/Shanghai' CST+8:00:00 STD>)
CST就是Central Standard Time的意思
datetime.datetime(2014,7,29, tzinfo=tz)
结果:datetime.datetime(2015, 5, 8, 15, 31, tzinfo=<DstTzInfo 'Asia/Shanghai' LMT+8:06:00 STD>)
LMT,这是Local Mean Time的缩写,是本地平均时