Convert Timestamp to Datetime
What is the correct way to convert event['timestamp'] in python to a regular datetime ?
Say your timestamp is
1498816797000. You can go to timestampconvert.com and type it in there to get the human readable time.
import datetime # divide by 1000 to remove milliseconds datetime.datetime.fromtimestamp(1498816797000/1000)
datetime.datetime(2017, 6, 30, 15, 29, 57)
Quoting from this page: https://upstox.com/developer/api/v1/docs/#live-feed
"timestamp string Time in microseconds at which the feeds was updated"
What I get in the feed is the time in milliseconds.
Please be consistent across the documentation and response. I just hope that the epoch is 1970-01-01, and is not changed (some, e.g., Google (cookies) tend to change the epochs).