开发者

how to deal with timezone differences in ical standard records using python?

I'm trying to process a ical recurrence record from the python gdata api.

DTEND: 20110421T190000
params for  DTEND:
   TZID [u'Europe/London']
DTSTART: 20110421T180000
params for  DTSTART:
   TZID [u'Europe/London']
RRULE: FREQ=WEEKLY;BYDAY=TH
VTIMEZONE
   TZID: Europe/London
   DAYLIGHT
      DTSTART: 19700329T010000
      TZOFFSETFROM: +0000
      TZNAME: BST
      TZOFFSETTO: +0100
      RRULE: FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU
   STANDARD
      DTSTART: 19701025T020000
      TZOFFSETFROM: +0100
      TZNAME: GMT
      TZOFFSETTO: +0000
      RRULE: FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU

   X-LIC-LOCATION: Europe/London

I can see from the event that the time frame should 'really' be 17:00 - 18:00 (British Summer Time) but DTSTART/DTEND seems to list GMT and then need "standard" to rectify?

I'm trying to set up an automatic process in python to 'read' these recurrence and replicate them as actual date and times.

What's开发者_运维技巧 the best way to do this to ensure accuracy? I know that dateutil can parse the timezone information, but which one do i pick, and most importantly how do I apply this change so that i get a python datetime object with the "real" time?

Thanks :)


I've used Pytz before, with great success: http://pytz.sourceforge.net/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜