<?php
$interval_in_seconds = 12 * 86400;
$checkin_in_seconds = floor(1413926734544 / 1000);
$next_checkin = $checkin_in_seconds + $interval_in_seconds;
$until_next = $next_checkin - time();
if($until_next > 0) {
$days = floor($until_next / 86400);
function secondsToTime($seconds) {
// Only here for var_dump testing:
global $settings, $interval_in_seconds, $until_next, $next_checkin;
$dtF = new DateTime("@0");
$dtT = new DateTime("@$seconds");
var_dump($until_next);
$return = $dtF->diff($dtT)->format('%h hours, %i minutes and %s seconds');
var_dump($until_next);
return $return;
}
$countdown = $days . ' days, ' . secondsToTime($until_next);
}
echo $countdown;
- Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.25, 7.3.0 - 7.3.12, 7.4.0
- float(1030519)
float(1030519)
11 days, 22 hours, 15 minutes and 19 seconds
- Output for 5.2.0 - 5.2.17
- float(1030519)
Fatal error: Call to undefined method DateTime::diff() in /in/8pBXR on line 19
Process exited with code 255. - Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6
- Fatal error: Class 'DateTime' not found in /in/8pBXR on line 15
Process exited with code 255. - Output for 4.4.2 - 4.4.9
- Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/8pBXR on line 19
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
- Parse error: parse error, unexpected T_OBJECT_OPERATOR in /in/8pBXR on line 19
Process exited with code 255. - Output for 4.3.2 - 4.3.4
- Parse error: parse error in /in/8pBXR on line 19
Process exited with code 255.
preferences:
192.04 ms | 401 KiB | 245 Q