Is there a way to make my mysql and php server automatically display dates in UK format.
At the moment I run a function to convert them.
the way the data is stored in the database 2012/06/20 the way i want the server to store it 20/06/2012
————–Update——————
//SQL_data comes from the table
echo $sql_date; // 2012/06/20
then i use this to swap the dates around.
function fixdate($in_date) {
$split_data = explode('-', $in_date);
if(count($split_data) == 3) {
$year = $split_data[2]; $month = $split_data[1]; $day = $split_data[0];
return "$year-$month-$day";
} else {
return FALSE;
}
}
then i display the date.
then i use the function again to store it in the database because it does not accept any other format.
My question is: is there a way that I can just set the default mysql date formate to UK standers.
hope i have explained it better this time.
In PHP, you can use the date() and strtotime() functions to convert date to whatever format you want. E.g. for DD-MM-YYYY