>>> v = [2010,11,12,0,0,0,0,0,0]
>>> time.mktime(v)
1289491200.0
>>> rtime = time.strptime('20101112', '%Y%m%d')
>>> time.mktime(rtime)
1289491200.0
>>> dt = datetime.datetime.fromtimestamp(1289491200.0)
>>> time.mktime(dt.timetuple())
1289491200.0
>>> dt
datetime.datetime(2010, 11, 12, 0, 0)
没有评论:
发表评论