pythondatetimetime

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


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


Solution

  • Using time.time():

    import time
    
    def current_milli_time():
        return round(time.time() * 1000)
    

    Then:

    >>> current_milli_time()
    1378761833768