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

0 votes
299 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
0 answers 191 views
asked Aug 19, 2016 in General by Shed
0 votes
1 answer 45 views
asked Aug 19, 2016 in General by Azi Graeber
+1 vote
1 answer 50 views
+2 votes
1 answer 52 views
asked Feb 9 in General by Marc Lentin
0 votes
2 answers 137 views
asked Nov 24, 2016 in General by srinivasulu_yagnam (180 points)
...