Page MenuHomeSoftware Heritage
Paste P1225

tryout
ActivePublic

Authored by ardumont on Nov 26 2021, 10:40 AM.
$ 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)