Re: Returning a formated dat
| From: | Paul DuBois | Date: | Fri, 02 Feb 2001 17:29:16 +0000 |
| Subject: | Re: Returning a formated dat | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-6324@lists.php.net to get a copy of this message | ||
At 9:13 AM +0000 2/2/01, Ben Cairns wrote:
I have a date stored in a MySQL field in a format like this: For example, 02/02/2001 (Today) would be stored as: 02022001 What I need to do is to format that so that it looks like: 02/02/2001I assume you really have this stored as a CHAR column, because you can't store a date as 02022001. On that assumption, you can format the string like this: SELECT
CONCAT(
LEFT(d,2),
"/",
MID(d,3,2),
"/",
RIGHT(d,4))
FROM t;
-- Ben Cairns - Head Of Technical Operations intasept.COM Tel: 01332 365333 Fax: 01332 346010 E-Mail: BenC@intasept.com Web: http://www.intasept.com "MAKING sense of the INFORMATION TECHNOLOGY age @ WORK......"-- Paul DuBois, paul@snake.net