David :
Try this :
$a = explode('-', '2010-01-23');
$b = array( $a[1], $a[2], $a[0] );
echo implode( '/', $b);
// 01/23/2010
Alejandro M.S.
-----Mensagem original-----
De: David Mehler [mailto:[email protected]]
Enviada em: quarta-feira, 29 de setembro de 2010 16:12
Para: php-general
Assunto: [PHP] converting a mysql date value
Hello,
I've got dates stored in a mysql database. The field is of type date
so the value is something like: "2010-09-29" I'm wanting to display
them as in U.S. dates as in month, day, year. I had a function that
did this, now it is not working and I am perplexed as to why. Here's
my echo statement:
<?php echo sqlDateFormat($row['date']); ?>
The $row['date'] is coming out of the mysql database. Here's the
sqlDateFormat function:
function sqlDateFormat($value) {
$date = $value;
$date = strtotime($date);
$date = date('m-d-y', $date);
return $date;
}
I'd appreciate any suggestions as to why this isn't working.
Thanks.
Dave.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php