0%

在Python中怎么将字符串日期转换为时间戳?

❓ 如何将"%d/%m/%Y"格式的字符串转换为时间戳?

1
"01/12/2011" -> 1322697600

✔️

1
2
3
4
5
>>> import time
>>> import datetime
>>> s = "01/12/2011"
>>> time.mktime(datetime.datetime.strptime(s, "%d/%m/%Y").timetuple())
1322697600.0