Fetch current date record of dd/mm/yyyy format in php mysql

Hello experts,

I am stuck with an query. Actually i want to fetch current date records from my database and the below code probably fetches all my current date records. But it fetches in d/m/y (26/01/14) format but i need in dd/mm/yyyy (26/01/2014) .
Below is the code which gives output as d/m/y format:


<?php
ini_set( "display_errors", 0);
$con=mysqli_connect("localhost","root","","test");
// Check connection
if (mysqli_connect_errno())
  {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }
$today = date('d-m-y');
$result = mysqli_query($con,"SELECT * FROM Persons WHERE DATE(startdate) = '$today'");

echo "<table border='1'>
<tr>
<th>id</th>
<th>name</th>
<th>Startdate</th>
<th>Details</th>

</tr>";

while($row = mysqli_fetch_array($result))
  {
  echo "<tr>";
echo "<td>" . $row['id'] . "</td>";
  echo "<td>" . $row['name'] . "</td>";
  echo "<td>" . $row['startdate'] . "</td>";
   echo "<td>" . $row['details'] . "</td>";
  echo "</tr>";
  }
echo "</table>";

mysqli_close($con);
?>


I tried with the above code and also tried to change the date format i.e :
$today = date(‘d-m-y’);
to $today = date(‘dd-mm-yyyy’);

I am not understanding what i am missing. Just need some help in this. Any help is appreciated.

You could use CURDATE() in the WHERE clause for the current date and you can use [URL=“http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_date-format”]DATE_FORMAT() in the SELECT clause to format the date as needed for the output. Both are MySQL functions (built into MySQL)

If you’re doing only with PHP use the format you want https://php.net/manual/en/function.date.php

Thanx for reply guys.
Well i have google a lot on this and even gone through the links but can some correct me the above code or is there any other code rather than the above which i pasted.
I am really stuck