Created
August 9, 2022 07:40
-
-
Save Park-Developer/b6acc59fb5371f93a8215504d15511a8 to your computer and use it in GitHub Desktop.
Get Current KST Time
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, timedelta | |
def get_kst_Time(): | |
now_time=datetime.now().strftime("%Y-%m-%d %H:%M:%S") | |
# datetime 값으로 변환 | |
utc_time_format=datetime.strptime(now_time,"%Y-%m-%d %H:%M:%S") | |
# KST 시간을 구하기 위해 +9시간 | |
kst_time_format=utc_time_format+timedelta(hours=9) | |
# 일자 + 시간 문자열로 변환 | |
return kst_time_format.strftime("%Y-%m-%d %H:%M:%S") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment