RE: Date Conversions?

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

 



From: Robert Sossomon [mailto: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?

I don't know how well PHP would handle the 2-digit year concept, so you
might be better off doing it in the query. Something like this:

SELECT DATE_FORMAT(date_field, '%m-%d-%y') AS date_format_1,
DATE_FORMAT(date_field, '%M %e, %y') AS date_format_2...

HTH!


-- 
Mike Johnson             Smarter Living, Inc.
Web Developer            www.smarterliving.com
mike@xxxxxxxxxxxxxxxxx   (617) 886-5539

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