khendar Posted January 18, 2008 Share Posted January 18, 2008 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 ? Quote Link to comment https://forums.phpfreaks.com/topic/86576-rss-date-problem/ Share on other sites More sharing options...
priti Posted January 18, 2008 Share Posted January 18, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/86576-rss-date-problem/#findComment-442452 Share on other sites More sharing options...
khendar Posted January 18, 2008 Author Share Posted January 18, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/86576-rss-date-problem/#findComment-442482 Share on other sites More sharing options...
priti Posted January 18, 2008 Share Posted January 18, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/86576-rss-date-problem/#findComment-442575 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.