Get today’s date time in PHP

Get today’s date time in PHP

This date time is based on the default server time zone. We can format it as required and without time as well.

echo $date = date('Y-m-d H:i:s');
// Or
echo $date = date('Y/m/d H:i:s');
// Or
echo $date = date('Y-m-d');
// Or
echo $date = date('Y/m/d');
OUTPUT :

2023-06-28 13:51:58
2023/06/28 13:51:58
2023-06-28
2023/06/28