<?php
$begin_time = strtotime("09:15");
$end_time = strtotime("14:00");
echo "begin_date is " . $begin_date->format('Y-m-d H:i:s') . " and end_date is " . $end_date->format('Y-m-d H:i:s') . "<br>";
$diff = (new DateTime(date("Y-m-d H:i:s", $end_time)))->diff(new DateTime(date("Y-m-d H:i:s", $begin_time));
$diff_in_hours = $diff->h + $diff->i / 60;
echo "The difference is " . $diff->h . " hours and " . $diff->i . " minutes, which is " . $diff_in_hours . " hours<br>";
- Output for 5.4.0 - 5.4.34
- Parse error: syntax error, unexpected ';' in /in/OK2ms on line 8
Process exited with code 255. - Output for 4.4.2 - 4.4.9, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29
- Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/OK2ms on line 8
Process exited with code 255. - Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1, 5.0.0 - 5.0.5
- Parse error: parse error, unexpected T_OBJECT_OPERATOR in /in/OK2ms on line 8
Process exited with code 255. - Output for 4.3.2 - 4.3.4
- Parse error: parse error in /in/OK2ms on line 8
Process exited with code 255.
preferences:
211.74 ms | 1394 KiB | 124 Q