I am trying to calculate the time between two values.
echo date("g:i a", (strtotime($moonrise) + strtotime($moonset))/2)
This is working well, however I am running into an issue if the moon sets the following day (EG 12.30am +1day).
Any suggestions as to how to solve this? I tried adding tomorrow / +1day but didnt seem to make a difference?
Cheers!
Thanks for your help, I tried adding tomorrow again and it worked! For others
date("g:i a", (strtotime($moonrise) + strtotime('tomorrow '.$moonset))/2)
How about that ?
$start = date_create('2017-03-02 15:00:00');
$end = date_create('2017-03-02 18:15:00');
$diff=date_diff($end,$start);
echo $diff->format('%H:%i');