using this method
arrow.utcnow().format('YYYY_MM_DD_HH_mm_ss')
or something similar in arrow is it possible to get milliseconds added to the time ?
using this method
arrow.utcnow().format('YYYY_MM_DD_HH_mm_ss')
or something similar in arrow is it possible to get milliseconds added to the time ?
In fact you can use up to 6 digits for representing fractions of a second:
>>> now = arrow.utcnow()
>>> now.format('YYYY-MM-DD HH:mm:ss.S')
u'2016-02-19 17:05:17.0'
>>> now.format('YYYY-MM-DD HH:mm:ss.SS')
u'2016-02-19 17:05:17.07'
>>> now.format('YYYY-MM-DD HH:mm:ss.SSS')
u'2016-02-19 17:05:17.073'
>>> now.format('YYYY-MM-DD HH:mm:ss.SSSS')
u'2016-02-19 17:05:17.0735'
>>> now.format('YYYY-MM-DD HH:mm:ss.SSSSS')
u'2016-02-19 17:05:17.07359'
>>> now.format('YYYY-MM-DD HH:mm:ss.SSSSSS')
u'2016-02-19 17:05:17.073591'
Starting from the 7th digit, the number start repeating (073591
in my case):
>>> now.format('YYYY-MM-DD HH:mm:ss.SSSSSS')
u'2016-02-19 17:05:17.073591'
>>> now.format('YYYY-MM-DD HH:mm:ss.SSSSSSSSSSSS')
u'2016-02-19 17:05:17.073591073591'
>>> now.format('YYYY-MM-DD HH:mm:ss.SSSSSSSSSSSSSSSSSS')
u'2016-02-19 17:05:17.073591073591073591'
You can use S
, SS
or SSS
in your format string to get milliseconds. So: arrow.utcnow().format('YYYY_MM_DD_HH_mm_ss_SSS')