// Assume you have a date string which is in d-m-Y format. $date_string = '18-04-2013'; // Create the DateTime object $date = date_create_from_format('d-m-Y', $date_string); // Print the date in Y-m-d format. print date('Y-m-d', $date->getTimestamp());
Done =)
Reference:
Filed under: PHP Tagged: PHP