...

View Full Version : RSS Date Problem



khendar
01-18-2008, 02:19 AM
I'm working on a script which reads an RSS feed, uses LastRSS to parse the feed and then inserts records into a calendar application using the pubDate field as the appointment date.

The problem I am having is getting the timezone on the calendar record correct. I can read the date from the feed in any format I wish, but the calendar only takes Unix Epoch timestamps, which are UTC. When I read the feed pubDate in as U and insert it to the calendar the dates are off by the timezone offset.

How can I determine the timezone offset based on the feed data, and adjust the timestamp that gets inserted into the calendar accordingly ?

oesxyl
01-18-2008, 08:34 AM
I'm working on a script which reads an RSS feed, uses LastRSS to parse the feed and then inserts records into a calendar application using the pubDate field as the appointment date.

The problem I am having is getting the timezone on the calendar record correct. I can read the date from the feed in any format I wish, but the calendar only takes Unix Epoch timestamps, which are UTC. When I read the feed pubDate in as U and insert it to the calendar the dates are off by the timezone offset.

How can I determine the timezone offset based on the feed data, and adjust the timestamp that gets inserted into the calendar accordingly ?

maybe this help you.

http://www.w3.org/TR/NOTE-datetime

best regards

GJay
01-18-2008, 08:55 AM
if you pass the RSS-date through strtotime does it not take into account the offset?

Inigoesdr
01-18-2008, 06:08 PM
if you pass the RSS-date through strtotime does it not take into account the offset?

It does actually; the timestamp is converted to the local timezone of the server. khendar, use date_default_timezone_set('Europe/London'); before you convert the date.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum