시간대 데이터베이스

Python에서 날짜와 시간 다루기

Max Shron

Data Scientist and Author

Python에서 날짜와 시간 다루기

시간대 데이터베이스

# import
from datetime import datetime
from dateutil import tz

tz 데이터베이스

Python에서 날짜와 시간 다루기

시간대 데이터베이스

# import
from datetime import datetime
from dateutil import tz

# 미국 동부 시간
et = tz.gettz('America/New_York')

tz 데이터베이스

  • 형식: 'Continent/City'
Python에서 날짜와 시간 다루기

시간대 데이터베이스

# import
from datetime import datetime
from dateutil import tz

# 미국 동부 시간
et = tz.gettz('America/New_York')

tz 데이터베이스

  • 형식: 'Continent/City'
  • 예:
    • 'America/New_York'
    • 'America/Mexico_City'
    • 'Europe/London'
    • 'Africa/Accra'
Python에서 날짜와 시간 다루기

시간대 데이터베이스

# 마지막 탑승
last = datetime(2017, 12, 30, 15, 9, 3, tzinfo=et)
print(last)
2017-12-30 15:09:03-05:00
Python에서 날짜와 시간 다루기

시간대 데이터베이스

# 마지막 탑승
last = datetime(2017, 12, 30, 15, 9, 3, tzinfo=et)
print(last)
2017-12-30 15:09:03-05:00
# 첫 탑승
first = datetime(2017, 10, 1, 15, 23, 25, tzinfo=et)
print(first)
2017-10-01 15:23:25-04:00
Python에서 날짜와 시간 다루기

시간대 데이터베이스

Python에서 날짜와 시간 다루기

Preparing Video For Download...