Skip to content

Instantly share code, notes, and snippets.

@yuliji
Last active October 4, 2020 05:23
Show Gist options
  • Save yuliji/ada6881ca700896ac7b02140d0e80a66 to your computer and use it in GitHub Desktop.
Save yuliji/ada6881ca700896ac7b02140d0e80a66 to your computer and use it in GitHub Desktop.
[python time iso]python time iso format
from datetime import datetime, timezone
datetime.now(tz=timezone.utc).isoformat()
#'2020-09-18T11:19:55.651168+00:00'
def get_timestamp():
now = datetime.datetime.utcnow()
t = now.isoformat("T", "milliseconds")
return t + "Z"
#2020-10-04T05:22:54.822Z
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment