After reading a few SO articles about converting to UNIX/Epoch time from a normal datetime
, I am still confused. Can someone explain what I'm not seeing here:
import time
from datetime import datetime
import dateutil.parser
import pytz
tz_LA = pytz.timezone('America/Los_Angeles')
tz_DV = pytz.timezone('America/Denver')
date_start_naive = '2017-04-16T00:00:00'
date_end_naive = '2017-04-16T23:59:59'
# Convert the ISO-8601 time into epoch time:
date_start_LA = tz_LA.localize(dateutil.parser.parse(date_start_naive))
date_start_DV = tz_DV.localize(dateutil.parser.parse(date_start_naive))
date_end = dateutil.parser.parse(date_end_naive)
print(date_start_LA.strftime('%s'))
print(date_start_DV.strftime('%s'))
print(date_end.strftime('%s'))
which produces:
>>> 1492322400
>>> 1492322400
>>> 1492408799
forgive my naivety, but shouldn't the first two integers be an hour different since 2017-04-16T00:00:00
in LA is 2017-04-16T01:00:00
in Denver?