CastlesBlog.com

a blog about a blog

Subscribe

Fixed RSS Greenwich Mean Time

I discovered this week through one of my projects at work that the rss feed was displaying the post date incorrectly. According to the rss specs the post date should be in GMT (Greenwich Mean Time). Previously the rss feed was displaying the time the post was made on the web server. Castlesblog is hosted on a server which is set to +10. I have fixed rss.php to display this correctly with the following code:

SQL

DATE_FORMAT(CONVERT_TZ(post_date,'".date('P')."','+00:00'), '%a, %e %b %Y %H:%i:%s') AS post_date_gmt_formatted,

XML

'.$db->getSafe('post_date_gmt_formatted').' +0000

The way this works is by using the MYSQL convert time zone function from the server time (+10) to GMT time (00). Its fairly simple really.. but got me stumped as Vienna (my feed reader) wasn't updating the times because it caches posts.

My next job is to update the rest of the site to allow for correct times.

Comments:

  1. Marc - 26th June 2009

    this is a test

Post Comment