I have date format in my database like this '13/09/2022' but my client suggest to change this format into this format '09/13/2022' so I use strtotime() but instead of having correct result it give this kind of result 01/01/1970 and you can see it give me wrong result. can someone explain what happen?
This is my code:
<?php
$oldDate = '13/09/2022';
$newDate = date("m/d/Y", strtotime($oldDate));
echo $newDate;
?>
Your can try this:
According to the documentation, 'DD/MM/YY' is not a standard format: https://www.php.net/manual/en/datetime.formats.php.