Syntax
strtotime(parameter);
Parameter
Return Type Returns the number of seconds passed since Jan 1, 1970.
getDate() This function return the date/time information of the passed parameter(date/time);
Parameter The parameter is optional as it takes the current local time as default parameter.
Return Type It returns the information of the date, day, year, month etc in an array.
Syntax
getDate(parameter);
Code for converting a string to date
<?php
$time_input=strtotime("2020/03/12");
$date_input=getDate($time_input);
print_r($date_input);
?>
<?php
$input='03/12/2020 1:33:05';
$date=strtotime($input);
echo date('d/m/y h:i:s',$date);
?>
<br><br>
<?php
$input = '05/10/2011 15:00:02';
$date = strtotime($input);
echo date('D/M/Y h:i:s', $date);
?>
<?php
$input = '05/10/2011 15:00:02';
$date = strtotime($input);
echo date('D/M/Y H:i:s', $date);
?>