In jQuery are function to set Minutes, Hours etc. Is this also in PHP?
I have:
$date = new DateTime();
and
$min = '23';
I would like in $date set minutes to $min.
Is possible? If yes, how?
You are looking for DateTime::setTime
.
If you want to modify the minutes and leave the hours untouched, you will of course have to pass the current hours value as the first parameter. Get that one with $dateTime->format('G')
.
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