@ 2016-01-06T16:49:08Z <?php
$date = '27 abril 2016';
echo date( 'Y-m-d 12:00:00', $date ); exit;
function transformDate($date){
$date = explode(' ', $date);
$month = NULL;
if( count($date) && count($date) == 3 ){
switch( $date[2] ){
case 'ene':
$month = 'enero 2016';
break;
case 'feb':
$month = 'febrero 2016';
break;
case 'mar':
$month = 'marzo 2016';
break;
case 'abr':
$month = 'abril 2016';
break;
case 'may':
$month = 'mayo 2016';
break;
case 'jun':
$month = 'junio 2016';
break;
case 'jul':
$month = 'julio 2016';
break;
case 'ago':
$month = 'agosto 2016';
break;
case 'sep':
$month = 'septiembre 2015';
break;
case 'oct':
$month = 'octubre 2015';
break;
case 'nov':
$month = 'noviembre 2015';
break;
case 'dic':
$month = 'diciembre 2015';
break;
}
// arrange the date and return
return $date[0].' '.$month;
}else
return NULL;
}
$event_date = transformDate( $date ); echo $event_date; exit;
$event_date2 = strtotime( $event_date );
$event_date3 = date( 'Y-m-d 12:00:00', $event_date2 );
echo $event_date3; exit;
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 8.0.0 - 8.0.30 , 8.1.0 - 8.1.28 , 8.2.0 - 8.2.18 , 8.3.0 - 8.3.6 Fatal error: Uncaught TypeError: date(): Argument #2 ($timestamp) must be of type ?int, string given in /in/lpvtO:3
Stack trace:
#0 /in/lpvtO(3): date('Y-m-d 12:00:00', '27 abril 2016')
#1 {main}
thrown in /in/lpvtO on line 3
Process exited with code 255 . Output for 5.5.0 - 5.5.38 , 5.6.0 - 5.6.28 , 7.0.0 - 7.0.20 , 7.1.0 - 7.1.20 , 7.2.6 - 7.2.33 , 7.3.16 - 7.3.31 , 7.4.0 - 7.4.33 Notice: A non well formed numeric value encountered in /in/lpvtO on line 3
1970-01-01 12:00:00 Output for 7.3.32 - 7.3.33 1970-01-01 12:00:00 preferences:dark mode live preview
201.04 ms | 401 KiB | 221 Q