Need the PHP query to display the date as MM-DD-YYYY instead of YYYY-MM-DD -


this question has answer here:

i need php query display date mm-dd-yyyy instead of yyyy-mm-dd. here code retrieve date, don’t know how convert date format.

$sql = 'select * tmp order photodate asc';  //display results   $result = $conn->query($sql); if ($result->num_rows > 0) {          // output data of each row          while($row = $result->fetch_assoc()) {                  echo  "<tr class=table-row><td align=center>".$row["photodate"]."<br><center>"."</center><br></td></tr>";     }          echo "</table>";  } else{      echo "0 results";   } arsort($band); $conn->close(); 

?>

you can in mysql in following way:

select date_format(photodate, '%m-%d-%y') tmp order photodate asc 

Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -