Re: Date Conversions?
| From: | Matthew Weier O'Phinney | Date: | Mon, 15 Nov 2004 20:01:52 +0000 |
| Subject: | Re: Date Conversions? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-202081@lists.php.net to get a copy of this message | ||
* Robert Sossomon <robert_sossomon@ncsu.edu>:
> 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@garden.org
Webmaster and IT Specialist | http://www.garden.org
National Gardening Association | http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org