Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

PHP Function For Converting UK Dd/mm/yyyy Format Into Yyyy-mm-dd Format For Inserting Into Mysql

DZone's Guide to

PHP Function For Converting UK Dd/mm/yyyy Format Into Yyyy-mm-dd Format For Inserting Into Mysql

·
Free Resource
// description of your code here
Convert Mysql Date
I am Using the following function to convert mysql date format into my req.


function uk_date_to_mysql_date($date){
$date_year=substr($date,6,4);
$date_month=substr($date,3,2);
$date_day=substr($date,0,2);
$date=date("Y-m-d", mktime(0,0,0,$date_month,$date_day,$date_year));
return $date; 
} 

echo uk_date_to_mysql_date($row['date']); //// $row['date'] is in the form :yyyy-mm-dd.
Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}