python strftime milliseconds code example
Example 1: python time.strptime milliseconds
time_string = "19/01/20 16:31:32.123"
format_string = "%d/%m/%y %H:%M:%S.%f"
date_object = datetime.strptime(time_string, format_string)
print(date_object)
Example 2: python datetime milliseconds
from datetime import datetime
print(datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S.%f')[:-3])
Example 3: python datetime milliseconds
from datetime import datetime
dt_obj = datetime.strptime('20.12.2016 09:38:42,76',
'%d.%m.%Y %H:%M:%S,%f')
millisec = dt_obj.timestamp() * 1000
print(millisec)