converting a mysql date value
| From: | David Mehler | Date: | Wed, 29 Sep 2010 19:11:42 +0000 |
| Subject: | converting a mysql date value | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-308358@lists.php.net to get a copy of this message | ||
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.