# Date Format In Mysql Table

**URL:** <https://www.phphelp.com/t/date-format-in-mysql-table/27155>\
**Category:** General PHP Help\
**Created:** [September 12, 2018, 7:17pm UTC](https://www.phphelp.com/t/date-format-in-mysql-table/27155 "2018-09-12T19:17:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![webchambers](https://www.phphelp.com/letter_avatar_proxy/v4/letter/w/ed655f/32.png) [@webchambers](https://www.phphelp.com/u/webchambers)\
**Post date:** [September 12, 2018, 7:17pm UTC](https://www.phphelp.com/t/date-format-in-mysql-table/27155/1 "2018-09-12T19:17:44Z")

</div>

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 …

```auto
$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";
}
$conn->close();
?> 

```

thanks guys

---

<div class="post-metadata">

**Author:** ![astonecipher](https://www.phphelp.com/user_avatar/www.phphelp.com/astonecipher/32/2797_2.png) [@astonecipher](https://www.phphelp.com/u/astonecipher)\
**Post date:** [September 12, 2018, 7:34pm UTC](https://www.phphelp.com/t/date-format-in-mysql-table/27155/2 "2018-09-12T19:34:45Z")

</div>

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.

[https://www.w3schools.com/sql/func\_mysql\_date\_format.asp](https://www.w3schools.com/sql/func_mysql_date_format.asp)

---

<div class="post-metadata">

**Author:** ![benanamen](https://www.phphelp.com/user_avatar/www.phphelp.com/benanamen/32/287_2.png) [@benanamen](https://www.phphelp.com/u/benanamen)\
**Post date:** [September 12, 2018, 11:09pm UTC](https://www.phphelp.com/t/date-format-in-mysql-table/27155/3 "2018-09-12T23:09:18Z")

</div>

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