0

When I display date from phpMyadmin to webpage with this code.

date format is showing y-m-d and how to change this in d-m-y

<?php echo $row['dob']; ?>
Dharman
  • 30,962
  • 25
  • 85
  • 135
vikram
  • 19
  • 3

1 Answers1

1

You can use DATE_FORMAT

SELECT DATE_FORMAT(column_name, '%d/%m/%Y') FROM tablename
Rakesh Jakhar
  • 6,380
  • 2
  • 11
  • 20
  • $originalDate = "2010-03-21"; $newDate = date("d-m-Y", strtotime($originalDate)); i use this code but its showing 12-31-1969 – vikram May 09 '19 at 16:57
  • This is a better answer, the date string should be formatted when output by MySQL *not* have to be re-processed by PHP after selection. – Martin May 09 '19 at 18:25