Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Paste
P1225
tryout
Active
Public
Actions
Authored by
ardumont
on Nov 26 2021, 10:40 AM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Tags
None
Subscribers
None
$ ipython
In [1]: 1626111425534 / 1e3
Out[1]: 1626111425.534
In [2]: timestamp = 1626111425534
In [7]: datetime.fromtimestamp(int(timestamp) / 1e3)
Out[7]: datetime.datetime(2021, 7, 12, 19, 37, 5, 534000)
In [8]: str( datetime.fromtimestamp(int(timestamp) / 1e3) )
Out[8]: '2021-07-12 19:37:05.534000'
In [9]: import iso8601
In [10]: date = datetime.fromtimestamp(timestamp / 1e3)
In [11]: str ( date )
Out[11]: '2021-07-12 19:37:05.534000'
In [12]: iso8601.parse_date(str ( date ) )
Out[12]: datetime.datetime(2021, 7, 12, 19, 37, 5, 534000, tzinfo=datetime.timezone.utc)
Event Timeline
ardumont
created this paste.
Nov 26 2021, 10:40 AM
2021-11-26 10:40:04 (UTC+1)
Log In to Comment