For some reason python is not parsing my date properly but I looked at the strftime/strptime behavior and it looks to be right
import time
d = 'May 17, 2018 3:10 AM PDT'
time.mktime(time.strptime(d, "%B %d, %Y %I:%M %p %Z"))
If I do:
time.strftime("%B %d, %Y %I:%M %p %Z")
I get May 18, 2018 02:47 PM EDT
, which looks to be the exact same format except for the leading 0 but strptime
should be able to parse leading 0
s.
What am I doing wrong in parsing this date?
Edit: Found out its the timezone but not sure why:
time.mktime(time.strptime("May 17, 2018 3:10 AM UTC", "%B %d, %Y %I:%M %p %Z"))
returns a value
time.mktime(time.strptime("May 17, 2018 3:10 AM PDT", "%B %d, %Y %I:%M %p %Z"))
returns ValueError