-1

I am fetching crypto data from the ByBit exchange which is returning the timestamp field created_at_e9 in the following format: 1663315207126761200

The standard is 11 -13 digits but here are 20 digits. How do I fetch the DateTime from it?

FObersteiner
  • 22,500
  • 8
  • 42
  • 72
Volatil3
  • 14,253
  • 38
  • 134
  • 263
  • Does this answer your question? [Converting unix timestamp string to readable date](https://stackoverflow.com/questions/3682748/converting-unix-timestamp-string-to-readable-date) (just adjust the unit) – FObersteiner Nov 28 '22 at 15:48

1 Answers1

1

You can look at this so see how to convert a timestamp into a datetime in python. And since the timestamp presision is 1e9 you can simply multiply the value by 1e-9 or divide it by 1e9 to get the timestamp in seconds.

from datetime import datetime
datetime.fromtimestamp(created_at_e9 * 1e-9)
ShadowCrafter_01
  • 533
  • 4
  • 19