You are here: Re: Displaying DATE or DATETIME in PHP « PHP Programming Language « IT news, forums, messages
Re: Displaying DATE or DATETIME in PHP

Posted by Rik Wasmus on 10/16/07 07:50

On Tue, 16 Oct 2007 09:42:28 +0200, Colleen Robledo, MLIS
<colleenrobledo@gmail.com> wrote:

> Hello,
>
> I'm still pretty new to PHP and MySQL, and have a PHP scripting
> question.
>
> If I'm querying DATE info from a MySQL database, and displaying it
> with PHP echo statements... is there a PHP script I can use to convert
> the DATE data to standard calendar format?
>
> Example:
>
> 2007-10-12 displayed as October 12, 2007

You are better of using the DATE_FORMAT(date_field, '%M %e, %Y') function
in MySQL, as it knows for sure what date it is:
http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_date-format

However, would you wish to do it in PHP, look at these:
http://www.php.net/strtotime
http://www.php.net/date
http://www.php.net/strftime
--
Rik Wasmus

 

Navigation:

[Reply to this 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

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