Date Format In Mysql Table


Hi Guys, I have a database and my date in my sql is stored as YYYY/MM/DD

when i fetch the results of the database i want the date to be shown as DD/MM/YY

here is my code …

$sql = "SELECT date, venue, price FROM gigs ORDER BY date ASC";

$result = $conn->query($sql);

if ($result->num_rows > 0) {
    // output data of each row
    while($row = $result->fetch_assoc()) {

echo "Date:" .$row  ["date"].  "<br>";
echo "Venue:" .$row  ["venue"].  "<br>";
echo "Price: &nbsp" .$row  ["price"].  "<br>";
echo "<BR>";


else {
    echo "No Messages";

thanks guys


How the date is stored doesn’t matter. What you want to do is format the date on the way out. You can do that in the query itself, or in PHP, your choice.


So it is actually stored with slashes instead of the correct date column format with dashes?