In my file I have columns of date in the ISO 8061 format with timezone information, here is the sample input
0001-01-01T00:00:00-05:00
2009-01-29T07:00:00-05:00
2009-01-29T13:00:00-05:00
2009-01-29T18:55:00-05:00
2010-01-22T12:00:00-05:00
2010-07-20T00:25:00-04:00
2010-08-14T00:30:00-04:00
2011-06-19T08:25:00.41683-04:00
so the format is YYYY-MM-DDTHH:MM:SS[f]-AB:CD
I want to know how I can format the given data to format required by RFC 2445 iCalendar specification [DTSTART], which are example :
19970714T133000 ;Local time
19970714T173000Z ;UTC time
TZID=US-Eastern:19970714T133000 ;Local time and time
I currently have following code for just parsing
>>> import dateutil.parser
>>> import dateutil
>>> import datetime
>>> dateutil.parser.parse('2009-01-29T07:00:00-05:00')
datetime.datetime(2009, 1, 29, 7, 0, tzinfo=tzoffset(None, -18000))
I want to know how to identify time zone ['-04:00','-05:00'] and how to convert them into UTC.
Thank you.