Welcome to WebmasterWorld Guest from 54.204.100.232

Forum Moderators: bill & werty

Message Too Old, No Replies

Changing the way date and time are displayed

Can I change the way the date and time is displayed?

   
8:40 am on Apr 12, 2010 (gmt 0)

5+ Year Member



I am trying to work out how to change the way the time/date are displayed in my feed. I am dynamically creating the feed through PHP, and it works fine but I would like the pubDate to not have the time in it as it is irrelevant to the content. Some browsers seem to show the year and some don't, so it would also be nice to get that to display on all browsers (perhaps this is not possible?) I am pulling the data from a mySQL database in the following format (yyyy-mm-dd) and then converting it to RFC2822. If I manually strip out the last 15 chataracters the pubDate is reverting to current time. Is there a way to at the very least remove the time from the end of the pubDate displayed? In IE I seem to be getting the day of the week too (which is fine and what I would really like everywhere), while in Chrome I don't seem to be getting any date/time. Safari and Firefox also do not display how I would like it. Perhaps this (as mentioned above) is browser related and there is nothing I can do about it? I have run the xml through an rss validator and it is happy with it. Thanks for any help in advance.
8:53 am on Apr 12, 2010 (gmt 0)

WebmasterWorld Administrator bill is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



Welcome to WebmasterWorld dnab.

I'm afraid your feed will not validate if you don't give it the proper format for pubDate. All date-times in RSS conform to the Date and Time Specification of RFC 822 [asg.web.cmu.edu].

I wouldn't be concerned what shows up in various aggregators or viewers if the feed conformed to the standard and was valid. You can't control how others interpret the standard, but you can generally be safe by following it yourself.
9:08 am on Apr 12, 2010 (gmt 0)

5+ Year Member



Thanks for the very quick response. Since I can't remove the time I have set it manually to 18:00 however although Safari seems to display the time as 6:00 PM, IE is displaying the time as 7:00:00 PM. I appreciate I can't control how the timestamp/pubDate is displayed but I am somewhat still confused! When I do a view code in IE the pub date reads as in the format of the following example: Thu, 26 Nov 2009 18:00 +0000

Is this a GMT/BST thing? I guess there isn't a way to fix that either and I have answered my own question? What would happen if an RSS feed needed to be accurate in the way the time was displayed? Thanks again for your help.
1:56 am on Apr 13, 2010 (gmt 0)

WebmasterWorld Administrator bill is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



It sounds like IE is accessing your system settings and adjusting for daylight savings (Summer) time. Just make sure that you are using the proper UTC time with your pubDate and then you should be safe.
3:42 am on Apr 13, 2010 (gmt 0)

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



Why the heck are newer protocols still using RFC 822?

RFC 3339 has been around for more than a decade and solves many issues (though probably not this one).
3:56 am on Apr 13, 2010 (gmt 0)

WebmasterWorld Administrator bill is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



Atom uses RFC 3339, but RSS 2 is still using RFC 822. I'm not sure why they're using these different standards. However, Atom is the newer spec.
8:43 am on Apr 13, 2010 (gmt 0)

5+ Year Member



Thanks for the continued help and advice.

My pubDate seems to be in a correct format. example below:

Tue, 02 Feb 2010 18:00:00 +0000

Time on IE computer is also correct!

Also what is the etiquette at the moment, should I be providing both RSS 2 and Atom. Is it OK to not have RSS at all if Atom is the newer standard?

Thanks again.
4:24 am on Apr 14, 2010 (gmt 0)

WebmasterWorld Administrator bill is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



This advice from last year still holds true: RSS Good Practices: Pick a Format (Any Format) [webmasterworld.com]