Re: Date Conversions?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* Robert Sossomon <robert_sossomon@xxxxxxxx>:
> I have a date in format YY-MM-DD in a MySQL table.  I need to pull it back to 
> display it in either format: MM-DD-YY or Month Day, Year format.
>
> I can't figure out how to write the query to do it, and am not sure
> how to make PHP just parse the one given and dump it back out in the
> way I need it.  Any suggestions?

http://php.net/strtotime

Specifically, try the following:

// $date is the date as pulled from the MySQL table
$convertedDate = date("m-d-y", strtotime($date));

-- 
Matthew Weier O'Phinney           | mailto:matthew@xxxxxxxxxx
Webmaster and IT Specialist       | http://www.garden.org
National Gardening Association    | http://www.kidsgardening.com
802-863-5251 x156                 | http://nationalgardenmonth.org

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux