Jump to content

Recommended Posts

Hello All,

 

I worte this bit of code so that a few graphics I have online will change if in between 2 dates. It goes something like this:

 

<?php


if(time() > strtotime('1262930400') && time() < strtotime('1263427199')){

	echo ('<tr><td align="center" valign="middle" colspan="2"><a href="http://www.raffledrums.com/acrylic-raffle-drums.htm"><img src="images/raffledrums_tn.jpg" border="0" hspace="0" vspace="5" width="238" height="98" alt="Giant Raffle Drums"></a></td></tr>');

}else{

echo ('<tr><td align="center" valign="middle" colspan="2"> </td></tr>');	
}

?>

 

However, it is not working correctly.

 

Am I doing something wrong in there that I am missing?

 

Thanks for the help and or advice on this,

 

Paul

Link to comment
https://forums.phpfreaks.com/topic/188370-graphic-change-based-on-date-span/
Share on other sites

Please note that

 

if(time() > 1262930400 && time() < 1263427199){

 

Will only work only once that is between 1262930400 and 1263427199. Once it exceeds 1263427199 it will never be shown again. Is this what you are looking for? Or is it more something like this

 

if (date('H', time()) == 15 && date('H', time()) < 18) {
  ..

 

Which displays something during a certain part of the day?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.