λ μ§μ μκ°
datetime module
- date: λ
, μ, μΌ
- time: μ, λΆ, μ΄, λ§μ΄ν¬λ‘μ΄
- datetime: λ μ§μ μκ°
- timedelta: λ μ§ μ/λλ μκ° κ°κ²©
from datetime import date
halloween = date(2019, 10, 31)
print(halloween)
print(halloween.day)
print(halloween.month)
print(halloween.year)
from datetime import timedelta
one_day = timedelta(days=1)
tomorrow = now+one_day
print(tomorrow)
print(now+17*one_day)
yesterday = now - one_day
print(yesterday)
from datetime import time
noon = time(12,0,0)
print(noon)
print(noon.hour)
print(noon.minute)
print(noon.second)
print(noon.microsecond)
from datetime import datetime
some_day = datetime(2015, 1, 2, 3, 4, 5, 6)
print(some_day)
print(some_day.isoformat())