RE: [PHP-DB] displaying a MySQL date in a different format
| From: | George Pitcher | Date: | Mon, 06 Jan 2003 14:41:45 +0000 |
| Subject: | RE: [PHP-DB] displaying a MySQL date in a different format | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-24588@lists.php.net to get a copy of this message | ||
Ali,
SELECT DATE_FORMAT('1997-10-04','%d/%m/%b/%Y');
gives you '04/10/1997'.
replace the date with the column name and I would suggest giving it an alias
such as eurodate or whatever fits your application.
HTH
George in Oxford
> -----Original Message-----
> From: Bernain, Fernando G. [mailto:fbernain@kpmg.com.ar]
> Sent: 06 January 2003 1:35 pm
> To: 'Ali McLeod'; php-db@lists.php.net
> Subject: RE: [PHP-DB] displaying a MySQL date in a different format
>
>
> I dont know if its the "best" solution, but I made a function
> that "cut" the
> date:
>
> function sqldate($fecha) {
>
> $dia=substr($fecha,0,2);
> $mes=substr($fecha,3,2);
> $anio=substr($fecha,6,4);
>
> $fechasql=$anio."/".$mes."/".$dia;
>
> return $fechasql;
>
> }
>
> You input 12/01/2002 and output 2002/01/12!!!!
>
>
> Fernando Bernain
> Senior A
> Business Process Outsourcing
>
> KPMG Argentina
> Tel: 54 11 4316 5754
> Fax: 54 11 4316 5734
> fbernain@kpmg.com.ar
>
>
>
>
> -----Original Message-----
> From: Ali McLeod [mailto:alimcleod@btinternet.com]
> Sent: Saturday, January 04, 2003 8:27 PM
> To: php-db@lists.php.net
> Subject: [PHP-DB] displaying a MySQL date in a different format
>
>
> Can anyone help me. I am trying to display a date in a different
> format from
> that stored in a MySQL database. MySQL forces you to store it as
> yyyy-mm-dd
> but I want to display it as dd-mm-yyyy, or dd-mmmm
>
> Any ideas?
>
> Many thanks in advance
>
> Ali McLeod
> alimcleod@btinternet.com
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> Email Disclaimer
>
> The information in this email is confidential and may be
> legally privileged.
> It is intended solely for the addressee.
> Access to this email by anyone else is unauthorised.
> If you are not the intended recipient, any disclosure,
> copying, distribution
> or any action taken or omitted to be taken in reliance
> on it, is prohibited and may be unlawful.
> When addressed to our clients any opinions or advice
> contained in this email are subject to the terms and
> conditions expressed in the governing KPMG client engagement
> letter.
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>