본문 바로가기
Appz Knowledge/Python

Python/날짜 및 시간

by 스쳐가는인연 2022. 12. 2.

# 날짜/시간:
---------------------------------------------------
from pytz import timezone
from datetime import datetime

seoul = timezone("Asia/Seoul")
now = datetime.now(seoul)

now.year
now.month
now.day
now.hour
now.minute
now.second

print("{}년 {}월 {}일 {}시 {}분 {}초".format(
    now.year,
    now.month,
    now.day,
    now.hour,
    now.minute,
    now.second
))
---------------------------------------------------

반응형