import time, datetime # 时间到字符串的转换 print time.strftime("%Y-%m-%d %X", time.localtime()) # 字符串到时间的转换 t = time.strptime("2008-08-08 09:32:10", "%Y-%m-%d %X") print t[0:6] y, m, d, H, M, S = t[0:6] print datetime.datetime(y, m, d, H, M, S)
本文出自 “岳贺庚” 博客,请务必保留此出处http://yhgcenter.blog.51cto.com/2623981/1954276
原文:http://yhgcenter.blog.51cto.com/2623981/1954276