I have a page on a website which I’m looking to set up a special offer on. I want to set it so that the offer only shows up to s certain date and time.
For example if I wanted to show an offer banner until it reached midnight on the 16th of November how would I code that?
Any help much appreciated.
Thanks in advance.
Modify as necessary.
<?php
if($time() < strtotime("Nov 17, 2010")) {
//Echo Ad Here
} ?>
Note: Nov 17,2010 = 11/17/2010 00:00:00 , which is the same thing as 11/16/2010 23:59:60 (Which is how i interpreted you saying ‘midnight on the 16th’)
Thanks for the super fast reply. I’ve modified your code slightly but I’m getting a call to undefined function error. Can you tell me where I’ve gone wrong please?
<?php
if($time() < strtotime("Nov 17, 2010")) {
echo "Test Data Here";
} ?>
er lol. Yeah, not sure why i put a $ in front of time… should just be time()
Excellent!! Thanks for the help. 