Created
July 19, 2020 16:55
-
-
Save utylee/afb173a5ea39eb5264ebf75c5fb95105 to your computer and use it in GitHub Desktop.
python datetime format timezone gmt utc kst correction
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 | |
#Sat, 18 Jul 2020 16:05:42 GMT | |
#fmt = '%a, %d %b %Y %H:%M:%S GMT' | |
fmt = '%d %b %Y %H:%M:%S' | |
dump_ts_str = datetime.datetime.strptime(server_time, fmt) | |
#dump_ts_str = time.strptime(server_time, fmt) | |
KST = datetime.timezone(datetime.timedelta(hours=9)) | |
dump1_ts_str = dump_ts_str.replace(tzinfo=datetime.timezone.utc).astimezone(tz=KST) | |
#korea_1_1 = datetime.datetime(2019, 1, 1, 0, 0, 0, tzinfo=KST) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment