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
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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.