HiveBrain v1.2.0
Get Started
← Back to all entries
snippetpythonCriticalCanonical

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

Submitted by: @import:stackoverflow-api··
0
Viewed 0 times
howmillisecondstimethecurrentpythonget

Problem

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

Code Snippets

import time

def current_milli_time():
    return round(time.time() * 1000)
>>> current_milli_time()
1378761833768

Context

Stack Overflow Q#5998245, score: 1032

Revisions (0)

No revisions yet.