How to convert date to string in PHP

1 Answer

0 votes
$date = new DateTime('2021-11-17');

$s = $date->format('Y-m-d');

echo $s;




/*
run:

2021-11-17

*/

 



answered Nov 17, 2021 by avibootz
...