Skip to content

Instantly share code, notes, and snippets.

@xethorn
Created May 18, 2016 14:27
Show Gist options
  • Save xethorn/4606637efd9b1ac1705cd07f9a4748be to your computer and use it in GitHub Desktop.
Save xethorn/4606637efd9b1ac1705cd07f9a4748be to your computer and use it in GitHub Desktop.
UTC Timestamp Python
from datetime import datetime
from datetime import timezone
def now_utc_timestamp():
"""Create a utc timestamp.
Args:
timestamp (int): the current timestamp, optional.
Returns:
int: the timestamp.
"""
return datetime.utcnow().replace(tzinfo=timezone.utc).timestamp()
@xethorn
Copy link
Author

xethorn commented May 18, 2016

Just an example on how to get a date to fully be utc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment