How to get the beginning of the day in PHP

1 Answer

0 votes
$timestamp = time(); // the current time

$beginning_of_day = strtotime("midnight", $timestamp);

echo date("Y-m-d H:i:s", $beginning_of_day);




/*
run:

2023-12-06 00:00:00

*/

 



answered Dec 6, 2023 by avibootz
...