hi all,
i can receive dates in the format day/month/year. However the format they are stored vary. i want to be able to convert these dates to mysql format Y-m-d.
The diifferent formatis i can get for day/month/year can be:
28/2/04
28/02/04
28/02/2004
28/2/2004
many more depending on the date. How can i simply just convert what ever format to mysql format Y-m-d.
DATES
Moderator: General Moderators
Code: Select all
function convert_date($date) {
$date_arr = explode('/', trim($date));
return date("Y-m-d", mktime(0, 0, 0, $date_arr[1], $date_arr[0], $date_arr[2]));
}