D
D
Dmitry2017-02-07 12:34:07
PHP
Dmitry, 2017-02-07 12:34:07

Right time?

Hello!
I can't figure out how to write the execution condition only in the interval from 23:00-23:10?
I do:

if(date('H:i') > "23:00" and date('H:i') < "23:10" and date('H') != "23") return;

What's wrong?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Denis Ruchiev, 2017-02-07
@muldy

if(strtotime(date('H:i')) > strtotime("23:00") && strtotime(date('H:i')) < strtotime("23:10")) return;

E
Evgeny Nikolaev, 2017-02-07
@khveugen_27

If more than 23:00 and less than 23:10 and at the same time the hour is not equal to 23 ?

R
Ruslan, 2017-02-07
@Sect0R

if( date('H') == 23 && ( date('i') < 0 && date('i') <=10 ) ) {
  return true;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question