Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def dt_get_timestamp(s, format="%Y-%m-%dT%H:%M:%S.%fZ"):
- ts = datetime.datetime.strptime(s, format)
- ts = ts.replace(tzinfo=pytz.UTC)
- ts = int(ts.timestamp() * 1000)
- return ts
- def dt_get_isostring(ts, format='%Y-%m-%dT%H:%M:%S.%fZ'):
- s = datetime.datetime.utcfromtimestamp(ts / 1000.0).strftime(format)
- return s
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement