1. 程式人生 > >Python 將字串時間轉換為 時間戳

Python 將字串時間轉換為 時間戳

a = "2018-03-10 18:26:27.531"
d = datetime.datetime.strptime(a, "%Y-%m-%d %H:%M:%S.%f")
t = d.timetuple()
timeStamp = int(time.mktime(t))
print(timeStamp)
1520677587

1、 python timestamp和datetime之間的轉換

2、Python 之 時間字串、時間戳、時間差、任意時間字串轉換時間物件

3、Python時間,日期,時間戳之間轉換

4、 python——時間與時間戳之間的轉換

5、Python獲取秒級時間戳與毫秒級時間戳