I have a string which has the value '2015-06-04 00:00:00'
How can I convert this to a date/time stamp using PHP?
Many thanks,
Alec
I have a string which has the value '2015-06-04 00:00:00'
How can I convert this to a date/time stamp using PHP?
Many thanks,
Alec
Try this code
$time = strtotime('2015-06-04 00:00:00'); // convert to datetime
$date = date('Y-m-d H:i:s',$time); // change format
got your answer you can convert it by use this
$date = strtotime('2015-06-04 00:00:00');
echo $date;
I always prefer to pass from a DateTime class.
php > $dateTime = new DateTime('2015-06-04 00:00:00');
php > echo $dateTime->format('d/m/Y');
04/06/2015