RE: [PHP] Date conversion problems
| From: | David Freeman | Date: | Mon, 26 Aug 2002 22:44:15 +0000 |
| Subject: | RE: [PHP] Date conversion problems | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-114182@lists.php.net to get a copy of this message | ||
> I have, in my database, a bunch of dates stored like this:
> YYYY-M. Month is obviously the number of the month (5), not
> the name (May).
>
> I want to convert the format to MMM, YYYY (ex: May, 2002),
Do the conversion in MySQL - it'll save you grief in the long run...
SELECT DATE_FORMAT(YYYY-M, '%b %y') AS DisplayDate FROM SomeTable WHERE
some = 'condition'
Will work with appropriate substitutions for your table structure.
CYA, Dave