There's a DateTime
-object. I want to set it to today and keep the time.
For example:
This won't work of course:
// this obviously changes it to 2012-11-22 00:00:00
$date->modify('today'));
This will work, but seems like a little much effort:
$clone = clone $date();
$date->modify('today')->setTime($clone->format('H'), $clone->format('i'));
Is there a shorter/more efficient way?
Not much better:
$newDate = new DateTime('today '.$date->format('H:i'));
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