风言枫语  

[steven@txzxp2 seccenter]$ python
Python 2.7.5 (default, Jul  8 2013, 09:48:59) 
[GCC 4.8.1 20130603 (Red Hat 4.8.1-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import datetime
>>> import time
>>> dateC=datetime.datetime(2013,9,5,11,00,00)
>>> timestamp=time.mktime(dateC.timetuple())
>>> print timestamp
1378350000.0
>>> ltime=time.localtime(1378350000)
>>> timeStr=time.strftime("%Y-%m-%d %H:%M:%S", ltime)
>>> print timeStr
2013-09-05 11:00:00
>>> 

posted on 2013-09-06 22:35  风言枫语  阅读(229)  评论(0编辑  收藏  举报