Computer >> Computer tutorials >  >> Programming >> Python

How to get current time in milliseconds in Python?


You can get the current time in milliseconds in Python using the time module. You can get the time in seconds using time.time function(as a floating point value). To convert it to milliseconds, you need to multiply it with 1000 and round it off. 

Example

import time
milliseconds = int(round(time.time() * 1000))
print(milliseconds)

Output

This will give the output −

1514825676008