Jump to content

Graphic Change Based on Date Span


psquillace

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?

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.