PHP Check time exceeding 11:00

I need help with data time. I am currently working with the Queue for the Hospital. Keys are supported when booking appointments. What I want to do is that I want to maintain a queue based on the current time. If the current time is less than 11:00, then the queue should start at 11:00 AM; else Queue should start at the current time.

+4
source share
3 answers
if(date("G") >= 11)      // or >10
{
  // current time is greater than 11:00 AM
}

Where the parameter Gfor the function dateindicates

24 hour hour format without leading zeros

Manual

+10
source
if(strtotime(date('H:i:s')) > strtotime(date('11:00:00'))){
  echo 'Greater than 11 AM';
}
else{
  echo 'Less than 11 AM';
}
+2
source

You can use something like the following:

if (time() >= strtotime("11:00 AM")) 
{
  echo "Greater than 11:00 AM";
}
else
{
    echo "Less than 11:00 AM";
}
0
source

Source: https://habr.com/ru/post/1547533/


All Articles