Forum Moderators: coopster
$date = '2005-04-15';
$parts = explode('-', $date);
$newDate = $parts[1] . '-' . $parts[2] . '-' . $parts[0];
I think there might also be a way for MySQL to return a formatted date, but I'm not sure how that is achieved (I normally store them as a unix timestamp).
$query = mysql_query("SELECT *,DATE_FORMAT(date, '%m-%d-%Y') as date_string FROM table") or die(mysql_error());
$row = mysql_fetch_object($query);
echo $row->date_string;
or if you use fetch_array of fetch_assoc use $row['date_string']
dc