问题描述
>>> import time
>>> import datetime
>>> s = "01/12/2011"
>>> time.mktime(datetime.datetime.strptime(s, "%d/%m/%Y").timetuple())
1322697600.0
解决方法
如何将格式转换"%d/%m/%Y"
为时间戳的字符串?
"01/12/2011" -> 1322697600
>>> import time
>>> import datetime
>>> s = "01/12/2011"
>>> time.mktime(datetime.datetime.strptime(s, "%d/%m/%Y").timetuple())
1322697600.0
如何将格式转换"%d/%m/%Y"
为时间戳的字符串?
"01/12/2011" -> 1322697600