Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Mar 2006
    Posts
    121
    Thanks
    0
    Thanked 0 Times in 0 Posts

    RSS Date Problem

    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 ?

  • #2
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by khendar View Post
    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

  • #3
    Senior Coder
    Join Date
    Sep 2005
    Posts
    1,791
    Thanks
    5
    Thanked 36 Times in 35 Posts
    if you pass the RSS-date through strtotime does it not take into account the offset?
    My thoughts on some things: http://codemeetsmusic.com
    And my scrapbook of cool things: http://gjones.tumblr.com

  • #4
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,647
    Thanks
    2
    Thanked 406 Times in 398 Posts
    Quote Originally Posted by GJay View Post
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •