|
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]
|