Reputation: 1548
I have a DIV on a page that I wanted to show only on Thursdays between 7pm and 8pm (local time) on a site. I made a post a while back and found my answer for that. Previous Post Here.
I was using this code to do so:
if( date('l') == "Thursday" && date('G') >= 19 && date('G') < 20 )
However now I need to show the div from 6:59:30 to 8:01pm (server time) and I'm not quite sure how I would format the statement above for that?
This would need to run weekly for an indefinite time until I remove the code.
Upvotes: 1
Views: 75
Reputation: 20492
if (date('l') == "Thursday" && date('His') >= '185930' && date('His') <= '200100')
Upvotes: 0
Reputation: 14479
if( date('l') == "Thursday" && date('Gis') >= 185930 && date('Gis') < 200100) {...
You should check out the php date manual for clarification: http://php.net/manual/en/function.date.php
Upvotes: 1
Reputation: 191749
if (date('l') == 'Thursday' && time() >= strtotime('18:59:30')
&& time() <= strtotime('20:01:00'))
Upvotes: 0