I m trying to change the date format in phpmyadmin. I m unable to change the format I want to change the format to dd-mmm-yyyy. How can I change the date format. Please help me
It's not possible as far as I know. I stand corrected, see @Madhura Jayaratne's answer for how to change the date format using phpMyAdmin. However, if that's not available or you don't have permission, you can use the solution below to reformat it in PHP.
Let's say your $date_from_sql is set to 2014-03-23.
$date = date('d-m-Y', strtotime($date_from_sql)); //date format
Now $date equals 23-03-2014
Optionally you can wrap it in a function to use it throughout your application.
function fixdate($date) {
return date('d-m-Y', strtotime($date));
}
// When parsing data from the database:
$query = query("SELECT wrongdate FROM something")->result();
$date = fixdate($query->date);