how to convert date data type to string in php code example
Example 1: Convert DateTime to String in PHP
phpCopy$theDate = new DateTime('2020-03-08');
echo $stringDate = $theDate->format('Y-m-d H:i:s');
//output: 2020-03-08 00:00:00
Example 2: date to string in php
Date to string
$date = "2021/03/13";
$newdate= date('d M, Y', strtotime($date));
echo $newdate;