Forum Moderators: coopster

Message Too Old, No Replies

pubdate not showing the correct time

         

surrealillusions

10:54 am on Mar 17, 2009 (gmt 0)

10+ Year Member



Hi all, got a strange problem.

I'm pulling in the RSS contents from a database, all goes well untill the pubdate.

This is the line which deals with the pubdate. There is no database checking or anything, as i'm the only one updating it and the db user only has read permissions. Anyway...

$output .= "<pubDate>" . ($info['pubDate']) . "</pubDate>";

Gets me 16 March 2009 00:00:00

In the database, the field type is datetime and has 2009-03-16 23:14:51

However..when i get rid of the <pubdate> tags,

It prints it how it is in the database - 2009-03-16 23:14:51

How come its not displaying the time correctly? Changing the field to text only and writing the date in by hand would be a bit of a cop out, as i'd like to know how to do it automagically or future purposes of writing scripts etc...

bill

11:06 am on Mar 17, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



This isn't an RSS issue. It would depend on the database or system you're using to output to the RSS file.

surrealillusions

3:19 pm on Mar 17, 2009 (gmt 0)

10+ Year Member



Ah, ok. Thought it was probably not solely RSS after I posted it.

I'm using PHP and MySQL to output to the file. Just seemed strange that the <pubdate> tag affected the output.

(Feel free to move the topic if you want)

:)

surrealillusions

3:07 pm on Mar 18, 2009 (gmt 0)

10+ Year Member



Solved the problem now.

The date format in MySQL is not in the required RFC 2822 format.

Just need to find a way of inserting it into the database the correct way or to convert the datetime stamp out of the database into the correct format when echoing the output.

:)