- var_dump: documentation ( source)
- date_create_from_format: documentation ( source)
- date_format: documentation ( source)
- date_default_timezone_get: documentation ( source)
<?php
function converteData($format, $to_format, $date, $timezone = null)
{
if (!$timezone) {
$timezone = new DateTimeZone(date_default_timezone_get());
}
$d = date_create_from_format($format, $date, $timezone);
return date_format($d, $to_format);
}
var_dump(converteData('dmY', 'Y-m-d', '06111992'));