time
模块也可以在这里提供帮助.. UTC 是协调世界时(以前称为格林威治标准时间,或 GMT)
In [18]: import time
In [19]: time.gmtime()
Out[19]: time.struct_time(tm_year=2012, tm_mon=9, tm_mday=22, tm_hour=3, tm_min=37, tm_sec=15, tm_wday=5, tm_yday=266, tm_isdst=0)
In [20]: x = time.gmtime()
In [21]: x.tm_year
Out[21]: 2012
In [22]: x.tm_mon
Out[22]: 9
In [23]: x.tm_mday
Out[23]: 22
In [24]: x.tm_hour
Out[24]: 3
您还可以在安装 pytz 时使用以下日志检查日志...
C:\>easy_install pytz
Searching for pytz
Reading http://pypi.python.org/simple/pytz/
Reading http://pytz.sourceforge.net
Reading http://sourceforge.net/project/showfiles.php?group_id=79122
Reading http://www.stuartbishop.net/Software/pytz
Reading http://sourceforge.net/projects/pytz/
Best match: pytz 2012d
Downloading http://pypi.python.org/packages/2.7/p/pytz/pytz-2012d-py2.7.egg#md5=
e6f9219ae6eff242f13c6700413df69e
Processing pytz-2012d-py2.7.egg
Moving pytz-2012d-py2.7.egg to c:\python27\lib\site-packages
Adding pytz 2012d to easy-install.pth file
Installed c:\python27\lib\site-packages\pytz-2012d-py2.7.egg
Processing dependencies for pytz
Finished processing dependencies for pytz
C:\>python
Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pytz
>>> from datetime import datetime, timedelta
>>> utc = pytz.utc
>>> utc.zone
'UTC'