Yes, change the date format in PHP using the date() along with strtotime(). Let’s say the following is our date −
$dateValue = "2020-09-19";
Change the date format using the strtotime() method −
$modifiedDate= date("d-m-Y", strtotime($dateValue));
Example
<!DOCTYPE html> <html> <body> <?php $dateValue = "2020-09-19"; echo "The original date format is=",$dateValue,"<br>"; $modifiedDate= date("d-m-Y", strtotime($dateValue)); echo "The changed date format is= ".$modifiedDate; ?> </body> </html>
Output
This will produce the following output
The original date format is=2020-09-19 The changed date format is= 19-09-2020