Created
May 18, 2016 14:27
-
-
Save xethorn/4606637efd9b1ac1705cd07f9a4748be to your computer and use it in GitHub Desktop.
UTC Timestamp Python
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 | |
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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just an example on how to get a date to fully be utc.