Reply to Re: [PHP] Convert a timestamp to RFC822??

Your name:

Reply:


Posted by Kevin Waterson on 10/21/52 11:26

This one time, at band camp, Brian Dunning <brian@briandunning.com> wrote:

> I get my timestamp from the db in this format (I don't have control
> over this):
>
> 2004-05-14 13:24:48
>
> I need to convert it to RFC822 to make it a valid RSS pubDate field
> like this:
>
> Wed, 02 Oct 2002 13:00:00 GMT
>
> How can I do that? I'm tearing my hair out here (what's left)...

SELECT *, DATE_FORMAT(yourdatecolumn,'%d, %m,%Y %h:%i %p') AS your_date FROM table

just change the %m options to suit the format you wish.
You will then have a field called your_date that you can access in your loop
like
while($row=mysql_fetch_array($result))
{
echo $row['your_date'];
}

enjoy,
kevin
--
"Democracy is two wolves and a lamb voting on what to have for lunch.
Liberty is a well-armed lamb contesting the vote."

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация