Home > database >  decode a 14-digit timestamp
decode a 14-digit timestamp

Time:01-23

I am running an API to get a report of events in bold360, the timestamps appear as 14-digits. example:

63778373872914 = 21/01/2022 63778307664492 = 20/01/2022

I discarded UNIX and ISO formats so far, Any idea of the timestamp format, I am using python to process the data and the bold360 documentation is not very specific.

CodePudding user response:

If you paste this "63778373872914" into an online timestamp converter, you either get a date in the future (Sunday, 2023026-03-19 12:41:54 UTC) or an invalid response on some other websites.

So I guess that something is wrong with the timestamp you got, maybe try changing it.

CodePudding user response:

The docs are pretty clear:

[...] REST API call returns a time value in .NET milliseconds [...]

So I'd assume those are milliseconds since 0001-01-01. Python example - because I can hack that together most quickly; should work in any language with datetime / duration support:

from datetime import datetime, timedelta

# 63778373872914 = 21/01/2022
print(datetime(1,1,1) timedelta(milliseconds=63778373872914))
# 2022-01-21 14:57:52.914000

# 63778307664492 = 20/01/2022
print(datetime(1,1,1) timedelta(milliseconds=63778307664492))
# 2022-01-20 20:34:24.492000
  •  Tags:  
  • Related