Check where the current time is between a given time limit or not - PHP

0 votes
401 views
asked May 19, 2016 in General by Mike
Hi there,

I want to change my website logo to something special on every Friday between night 8PM and 1AM. Theoretically 1AM is on the next day which is Saturday. How to do this with PHP ? Thanks in advance.

- Mike

1 Answer

0 votes
answered May 19, 2016 by anonymous

It is easy with strtotime() ;)

$current_time = strtotime('now');
if ($current_time > strtotime('friday this week 8:00pm') && $current_time < strtotime('saturday this week 1:00am')) {
    // Special logo
}

Related questions

0 votes
1 answer 445 views
asked Aug 19, 2016 in General by Shed
0 votes
2 answers 23 views
0 votes
1 answer 49 views
asked Aug 19, 2016 in General by Azi Graeber
0 votes
1 answer 653 views
...