How to format the DateTime object as a string in PHP

1 Answer

0 votes
$dt = new DateTime("2025-06-08");

echo "Date: " . $dt->format("Y-m-d");



/*
run:

Date: 2025-06-08

*/

 



answered Jun 8, 2025 by avibootz
...