Get current time in milliseconds using Python
Time module in Python provides various time-related functions. This module comes under Python’s standard utility modules, so there is no need to install it externally.
time.time() method of Time module is used to get the time in seconds since epoch. The handling of leap seconds is platform dependent.
Note: The epoch is the point where the time starts, and is platform dependent. On Windows and most Unix systems, the epoch is January 1, 1970, 00:00:00 (UTC) and leap seconds are not counted towards the time in seconds since the epoch. To check what the epoch is on a given platform we can use
Return type: This method returns a float value which represents the time in seconds since the epoch.
Time in milliseconds since epoch 1576071104408
Example 2: Using lambda function
Time in milliseconds since epoch 1576071316487
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course