ใช้โมดูล time ดึงเวลาปัจจุบันเป็นมิลลิวินาที time.time() คืนวินาที (float) คูณ 1000 แล้วปัดเศษ
ตัวอย่าง
import time
milliseconds = int(round(time.time() * 1000))
print(milliseconds)
ผลลัพธ์
1514825676008
ใช้โมดูล time ดึงเวลาปัจจุบันเป็นมิลลิวินาที time.time() คืนวินาที (float) คูณ 1000 แล้วปัดเศษ
import time
milliseconds = int(round(time.time() * 1000))
print(milliseconds)
1514825676008