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

Your name:

Reply:


Posted by Niels Ganser on 10/01/51 11:26

Usually you can use a function in your SELECT statement to change the
format of your timestamp. In MySQL it's DATE_FORMAT [1]. Otherwise use
PHP's Date and Time Functions [2]. You could for instance extract the
"ingredients" of your database's timestamp with strptime [3] and
reformat it with strftime [4].

Regards,
Niels


[1]
http://dev.mysql.com/doc/mysql/en/date-and-time-functions.html#id2728257
[2] http://php.net/manual/en/ref.datetime.php
[3] http://php.net/manual/en/function.strptime.php
[4] http://php.net/manual/en/function.strftime.php

> 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)...

[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

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