Safari RSS adds 1 hour to the date

Discussion in 'Web Design and Development' started by Devan, Mar 29, 2009.

  1. Devan macrumors newbie

    Joined:
    Jan 8, 2009
    #1
    I created an application for my school computing project which alerts its user when a new order is processed via rss. But for some reason safari's rss adds 1 hour to the date i.e the order was actual sent at 1.30 safari would say it was sent at 2.30. Really irritating.

    Here is a snippet, any ideas? the date is formated the normal time stamp manner i.e. 2009-03-30 01:35:17

    Code:
    <entry>
        <title><?php echo '#'.$orderID.' '.$productName.' - '.$fullName.' '.$productCurrency.$orderTotal; ?></title>
        <category term="New Order"/> 
        <id><?php echo '#'.$orderRef.$orderID; ?></id>
        <published><? echo $date; ?></published>
        <updated><? echo $date;?></updated>
        <summary><?php echo '#'.$orderRef; ?>    <?php echo $productCurrency.$orderTotal; ?></summary>
        <content><?php echo '#'.$orderRef; ?> </content>
      </entry>
    
    
    $date = the date pulled from the database, of when the order was processed.
    the code is a little unclean but yeah. any ideas?
     
  2. r.j.s Moderator emeritus

    r.j.s

    Joined:
    Mar 7, 2007
    Location:
    Texas
    #2
    Wrong time zone somewhere, either in the feed or the Mac?
     
  3. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #3
    When outputting the date in the RSS be sure to include the timezone. It doesn't look like you are currently.
     
  4. SrWebDeveloper macrumors 68000

    SrWebDeveloper

    Joined:
    Dec 7, 2007
    Location:
    Alexandria, VA, USA
    #4
    In the RSS output, you should format the time according to these specs otherwise crazy things can happen when parsed:
    • RSS 1.0 states that all date elements must conform to W3CDTF, which is a profile of ISO 8601:1988.
    • RSS 2.0 states, “All date-times in RSS conform to the Date and Time Specification of RFC 822, with the exception that the year may be expressed with two characters or four characters (four preferred).”
    Example 8601: 2004-02-12T15:19:21+00:00
    Example RFC822: Thu, 21 Dec 2000 16:01:07 +0200

    You should store the date/time as a timestamp or convert it to a timestamp upon retrieval (either one), then use the PHP5 date() functions for the conversions, i.e. the O or P parameters to determine the GMT offset in the desired format and r for full RFC-822 format and c for full IS0-8601 format with the timestamp passed to the function as well. If you run PHP4 still, then see php.net date function for further assistance.

    -jim
     

Share This Page