thieumao

check time

May 28th, 2014
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.57 KB | None | 0 0
  1. <?php
  2. $timeStart = "01:30:00";
  3. $timeEnd = "06:00:00";
  4. // Gio G+0
  5. $timeNowFull =   $_SERVER['REQUEST_TIME'];
  6. // Gio G+7
  7. //$timeNowFull =   $_SERVER['REQUEST_TIME'] + 7*60*60;
  8. $timeNow = gmdate("H:i:s", $timeNowFull);
  9.  
  10. $timestampStart = strtotime($timeStart);
  11. $timestampEnd = strtotime($timeEnd);
  12. $timestampNow = strtotime($timeNow);
  13.  
  14. if (($timestampNow>$timestampStart) && ($timestampNow<$timestampEnd)){
  15.     echo "OK";
  16. } else {
  17.     echo "NOT OK";
  18. }
  19.  
  20. // Xuat ra de check
  21. echo "<br>timeStart = $timeStart";
  22. echo "<br>timeEnd = $timeEnd";
  23. echo "<br>timeNow = $timeNow";
  24. ?>
Advertisement
Add Comment
Please, Sign In to add comment