calculate next day at 8am - PHP Online
Form of PHP Sandbox
Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php
in the places where the PHP script should be executed.
Result of php executing
Full code of calculate next day at 8am.php
- <?php
- $timeZone = 3600;
- $serverTime = time();
- echo 'Current Server time: '.date("Y-m-d H:i:s",$serverTime).PHP_EOL;
- $currentDeviceTime = time()+$timeZone;
- echo 'Current Device time: '.date("Y-m-d H:i:s",$currentDeviceTime).PHP_EOL;
- //calculate next day for device time
- $nextDay = mktime(8,0,0,date("n", $currentDeviceTime),date("j",$currentDeviceTime)+ 1 ,date("Y", $currentDeviceTime))-$timeZone;
- echo 'Next Day Device time: '.$nextDay.PHP_EOL;
- $diff = strtotime($nextDay)-$currentDeviceTime;
- echo 'Defference between nextday and current device time is = '.$diff;