date periods?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Id like to be able to add text to my site but have it only saying that for a  
couple of months. Is this easy to do?

Re: date periods?

So you want to have some text displayed up until a specified date? If
so, this will do it:

<? if (mktime() < mktime (0,0,0,1,1,2006)) echo "hello"; ?>

If the current date is before the 1st Jan 2006, then show the text.
Otherwise don't.

Hope that helps,

Re: date periods?

Dave Turner wrote:
Quoted text here. Click to load it

Yes.  There are many ways of doing it.  One example:

$date = 'February 22, 2006';
if (time() < strtotime($date)) {
  echo "This is the text that should appear before $date";
} else {
  echo "This is the text that should appear after $date";


Site Timeline