Last active
October 4, 2020 05:23
-
-
Save yuliji/ada6881ca700896ac7b02140d0e80a66 to your computer and use it in GitHub Desktop.
[python time iso]python time iso format
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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