I have a tedious function that does something like this:
...
if ('PDT' in stringVal) or ('PST' in stringVal):
utcdateTime = convert(stringVal)+(hardcode the offset)
elif('EDT' in stringVal)...
...
I looked at several posts including this but couldn't find anything that fits my purpose. I also looked at datetime.datetime
and the whole datetime
module in general but it has things like .now()
; .utcnow()
; datetime.now(tz.pytz.utc)
etc etc. Basically if I have something like:
2014-05-01 01:02:03 PDT
2014-05-01 01:02:03 PST
2014-05-01 01:02:03 EDT
2014-05-01 01:02:03 EST
2014-05-01 01:02:03 MDT
2014-05-01 01:02:03 MST
Is there a python module that has some method I can use to convert those above datetime strings to UTC? If there is none, I will just stick with the hard-coded way I have.