Home » Php » Can not convert string to date format using PHP [on hold]

Can not convert string to date format using PHP [on hold]

Posted by: admin June 30, 2018 Leave a comment

Questions:

I am acing one issue. I could not convert string to date using PHP. I am explaining my code below.

<?php
$date="26-05-2018";
$result=date("d-m-Y",strtotime($date));
echo (gettype($result));//string
?>

Here I have the date value whose datatype is already string and I need to convert it to date but in my case its string coming again.

Answers: