[icalendar-dev] timezones

Charles McLaughlin cmclaughlin at atlassian.com
Thu Apr 17 03:11:24 CEST 2008


Hi,

I'd love some advise on the best way to shift timezones.  I've attached 
some code below.  I'm new to this package and haven't dealt with date 
and time in Python much.

I have have an entry in my ics file that is in another time zone.  I 
want to convert it to US pacific time or the timezone of the localhost. 
   Does the iCalendar package provide any methods for extracting dtstart 
and dtend in local time?  Or should I just use standard Python packages 
for this?

Thanks,
Charles

--------

from icalendar import Calendar, Event, vDatetime

cal = Calendar.from_string(open('cal.ics','rb').read())

for event in cal.walk('vevent'):

         print "Date Start: "
         dtstart = vDatetime.from_ical(str(event['dtstart']))
	print dtstart
         print event['dtstart'].params  # prints time zone info




The event I want to shift to local time is:

Date Start:
2007-12-05 11:00:00
TZID=(GMT+10.00) Canberra / Melbourne / Sydney



More information about the icalendar-dev mailing list