Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

PHP function for converting UK dd/mm/yyyy format into yyyy-mm-dd format for inserting into mysql (See related posts)

// 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.

You need to create an account or log in to post comments to this site.


Click here to browse all 7718 code snippets

Related Posts