Re: reformatting date string
| From: | php3 at developersdesk dot com | Date: | Wed, 30 Aug 2000 04:44:13 +0000 |
| Subject: | Re: reformatting date string | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-14302@lists.php.net to get a copy of this message | ||
Addressed to: "David Knape" <dave@tkdave.com>
"PHP General" <php-general@lists.php.net>
"dbarber" <dbarber@sailnet.com>
** Reply to note from "David Knape" <dave@tkdave.com> Tue, 29 Aug 2000 11:33:01
-0500
>
> I just happend to write something similar yesterday to convert mysql
> date stamps. In that case, just explode at the hyphens. Here, we just
> convert the number to a string, then use string functions. It only
> looks long, because of the case statements that set the month.
Why not just ask MySQL for the date in the format you want...
http://www.mysql.com/documentation/mysql/commented/manual.php?section=Date_and_time_functions
Look for DATE_FORMAT
SELECT DATE_FORMAT( SomeDate, '%M %D, %Y' ) AS FormattedDate, ...
Gives:
Aug 26th, 2000
Rick Widmer
Internet Marketing Specialists
www.developersdesk.com