티스토리 뷰

공부 (@Deprecated)

[Python] timezone KST

승가비 2020. 4. 16. 00:40
728x90
# pip install pytz

from pytz import timezone
from datetime import datetime


fmt = "%Y-%m-%d %H:%M:%S %Z%z"
UTC = datetime.now(timezone('UTC'))
KST = datetime.now(timezone('Asia/Seoul'))

print UTC
print KST

print UTC.strftime(fmt)
print KST.strftime(fmt)

https://technote.kr/202

 

[04-3] Python - Timezone 변경하기

개인적으로 사용하고 있는 서버의 System time은 UTC(세계표준시간)로 설정되어 있다. KST로 설정하면 별다른 코드없이 바로 해당 시간 사용이 가능하겠지만 KST보다는 UTC로 운영하고 있다. 하지만 종종 코드상에..

technote.kr

 

728x90

'공부 (@Deprecated)' 카테고리의 다른 글

[Hadoop] WebHDFS REST API  (0) 2020.04.16
[CSS] Mouse hover rainbow font-color  (0) 2020.04.16
[Python] BeautifulSoup4 select  (0) 2020.04.14
[Python] flask  (0) 2020.04.14
[Python] Ternary operator (3항 연산자)  (0) 2020.04.14
댓글