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"));
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');
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 DateInterval('P2Y1DT9S'));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With