Jump to content

RSS Date Problem


khendar

Recommended Posts

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 ?

Link to comment
https://forums.phpfreaks.com/topic/86576-rss-date-problem/
Share on other sites

in which format you are receving 'lastBuildDate'??? have you set var $date_format = 'U'; ?? please explain  "When I read the feed pubDate in as U and insert it to the calendar the dates are off by the timezone offset." if possible by example what you are saving and what is getting saved in DB.

 

Regards

Link to comment
https://forums.phpfreaks.com/topic/86576-rss-date-problem/#findComment-442452
Share on other sites

in which format you are receving 'lastBuildDate'??? have you set var $date_format = 'U'; ?? please explain  "When I read the feed pubDate in as U and insert it to the calendar the dates are off by the timezone offset." if possible by example what you are saving and what is getting saved in DB.

 

Regards

 

The date can be read in as any format I wish. In the feed it is formatted as RFC time, but I used 'U' to convert it to Unix Epoch.

 

Basically when I read the pubDate in as a Unix Timestamp, and insert it directly into the database, then the calendar event appears 9.5 hours early (timezone here is +9.5 hours). I need to work out how to compensate for this so they are inserted in the correct time.

Link to comment
https://forums.phpfreaks.com/topic/86576-rss-date-problem/#findComment-442482
Share on other sites

Hi,

 

As you said you are getting the lastBuildDate in U format then why don't you convert acoording to you TZ and then insert in database.

 

date_default_timezone_get(); will help you to find the timeZone and if you want to set the timezone and use date_default_timezone_set ('America/Chicago'); where as 'america/Chicago' is the timezone identifier.

 

you might find this useful

 

regards

 

 

Link to comment
https://forums.phpfreaks.com/topic/86576-rss-date-problem/#findComment-442575
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.