Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
5 views
in Python by (47.6k points)

How can I get the current time in milliseconds in Python?

1 Answer

0 votes
by (106k points)

There are multiple ways of doing this problem some of the important methods I am discussing here:-

The first way we can solve this problem by using the time module and round() function:-

import time

millisec = int(round(time.time() * 1000))

print(millisec)

image

Another method we have is to use the lambda function to solve this problem module:-

import time

current_milli_time = lambda: int(round(time.time() * 1000))

current_milli_time()

image

Related questions

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...