Re: Returning a formated dat

From: Date: Fri, 02 Feb 2001 14:30:11 +0000
Subject: Re: Returning a formated dat
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-6318@lists.php.net to get a copy of this message
Ben, The easiest (and quickest) way I've done this in the past is to use MySQL's DATE_FORMAT function when doing the SELECT. To format it like you want try this: SELECT DATE_FORMAT(date_column, '%m/%d/%y') as f_date FROM Table_name; Be sure to use the correct name for the column that the date is stored in. To get more info on the DATE_FORMAT function, check out the MySQL online manual. http://www.mysql.com/documentation/mysql/bychapter/manual_Reference.html#Dat e_and_time_functions Regards, Adam Younce adam@ripcord.net ----- Original Message ----- From: "Ben Cairns" <BenC@intasept.com> To: <php-db@lists.php.net> Sent: Friday, February 02, 2001 4:13 AM Subject: [PHP-DB] Returning a formated dat > 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/2001 > > -- 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......" > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > For additional commands, e-mail: php-db-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.db (#6318) next »