Set time in php to 00:00:00
问题 I need to display the time but it must start from 00:00:00? I've got the following but it uses the current time. print(date("H:i:s")); 回答1: As an alternative to mktime() , try the newer DateTime class, eg $dt = new DateTime; $dt->setTime(0, 0); echo $dt->format('H:i:s'); // Add one hour $dt->add(new DateInterval('PT1H')); echo $dt->format('H:i:s'); Update The flexibility of DateInterval makes this a very good candidate for a timer, eg // add 2 years, 1 day and 9 seconds $dt->add(new