Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 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

0 votes
1 answer
+2 votes
2 answers
asked May 23, 2019 in Python by Anvi (10.2k points)
0 votes
1 answer
Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.4k questions

29.7k answers

500 comments

94.1k users

Browse Categories

...