Advertisement
Guest User

Untitled

a guest
Apr 18th, 2014
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.64 KB | None | 0 0
  1. function getslot($day) {
  2. $current_time = strtotime('now');
  3. #echo $day;
  4. #echo $date = date("Y-m-d H:i:s");echo "\n";
  5. #echo $current_time."\n";
  6. #echo strtotime("today 12:00pm");
  7.  
  8. if ($current_time > strtotime('today 12:00am') && $current_time < strtotime('today 2:00am')) { $slot=1; }
  9. if ($current_time > strtotime('today 2:00am') && $current_time < strtotime('today 4:00am')) { $slot=2; }
  10. if ($current_time > strtotime('today 4:00am') && $current_time < strtotime('today 6:00am')) { $slot=3; }
  11. if ($current_time > strtotime('today 6:00am') && $current_time < strtotime('today 8:00am')) { $slot=4; }
  12.  
  13. if ($current_time > strtotime('today 8:00am') && $current_time < strtotime('today 10:00am')) { $slot=5; }
  14.  
  15. if ($current_time > strtotime('today 10:00am') && $current_time < strtotime('today 12:00am')) { $slot=6; }
  16.  
  17. if ($current_time > strtotime('today 12:00pm') && $current_time < strtotime('today 2:00pm')) { $slot=7; }
  18.  
  19. if ($current_time > strtotime('today 2:00pm') && $current_time < strtotime('today 4:00pm')) { $slot=8; }
  20.  
  21. if ($current_time > strtotime('today 4:00pm') && $current_time < strtotime('today 6:00pm')) { $slot=9; }
  22.  
  23. if ($current_time > strtotime('today 6:00pm') && $current_time < strtotime('today 8:00pm')) { $slot=10; }
  24.  
  25. if ($current_time > strtotime('today 8:00pm') && $current_time < strtotime('today 10:00pm')) { $slot=11; }
  26.  
  27. if ($current_time > strtotime('today 10:00pm') && $current_time < strtotime('today 11:59pm')) { $slot=12; }
  28.  
  29. #echo time('now');
  30. #$thetime = date("h:i a");
  31. #$time = strtotime("+2hours");
  32. #print date('l jS \of F Y h:i:s A', $time);
  33. #cho $thetime;
  34. #echo $slot;
  35. #echo "slot: ".$slot."\n";
  36. return $slot;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement