Right, I'm receiving a date from my mySQL database, the date is saved in a YYYY-MM-DD format, I want to call this as a $date = row['date'] variable and then somehow re-order it in php so that it is a DD-MM-YYYY format instead, I am not sure how I can achieve this though.
Someone please help.
$date = "2010-12-23";
echo date("d-m-Y" , strtotime($date));
SELECT DATE_FORMAT(date_here, "%d-%m-%Y") FROM table_here
Use DateTime which is a new class in PHP5.
http://ca2.php.net/manual/en/datetime.construct.php
<?php
try {
$date = new DateTime('2000-01-01');
} catch (Exception $e) {
echo $e->getMessage();
exit(1);
}
echo $date->format('d-m-Y');
?>