Created
October 18, 2022 08:57
-
-
Save chandra-prakash-meghwal/d13f70258476aa7dde54c3ac7676688d to your computer and use it in GitHub Desktop.
Get Date Time in UTC from the given timestamp
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
import datetime | |
def get_utc_datetime_from_timestamp(timestamp): | |
""" | |
datetime.datetime.utcfromtimestamp returns utc date time | |
whereas datetime.datetime.fromtimestamp returns local (system) date time | |
""" | |
return str(datetime.datetime.utcfromtimestamp(int(timestamp))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment