タイムゾーンデータベース

Pythonで扱う日付と時刻

Max Shron

Data Scientist and Author

Pythonで扱う日付と時刻

タイムゾーンデータベース

# Imports
from datetime import datetime
from dateutil import tz

tz データベース

Pythonで扱う日付と時刻

タイムゾーンデータベース

# Imports
from datetime import datetime
from dateutil import tz

# Eastern time
et = tz.gettz('America/New_York')

tz データベース

  • 形式: 'Continent/City'
Pythonで扱う日付と時刻

タイムゾーンデータベース

# Imports
from datetime import datetime
from dateutil import tz

# Eastern time
et = tz.gettz('America/New_York')

tz データベース

  • 形式: 'Continent/City'
  • 例:
    • 'America/New_York'
    • 'America/Mexico_City'
    • 'Europe/London'
    • 'Africa/Accra'
Pythonで扱う日付と時刻

タイムゾーンデータベース

# Last ride
last = datetime(2017, 12, 30, 15, 9, 3, tzinfo=et)
print(last)
2017-12-30 15:09:03-05:00
Pythonで扱う日付と時刻

タイムゾーンデータベース

# Last ride
last = datetime(2017, 12, 30, 15, 9, 3, tzinfo=et)
print(last)
2017-12-30 15:09:03-05:00
# First ride
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...