sign in | join about | help | sitemap
Connecting Tech Pros Worldwide
Dave Turner's Avatar

date periods?


Question posted by: Dave Turner (Guest) on December 22nd, 2005 10:45 AM
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?


2 Answers Posted
Fred Forsyth's Avatar
Guest - n/a Posts
#2: 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,
Fred.

NC's Avatar
Guest - n/a Posts
#3: Re: date periods?

Dave Turner wrote:[color=blue]
>
> 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?[/color]

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";
}

Cheers,
NC

 
Not the answer you were looking for? Post your question . . .
196,948 members ready to help you find a solution.
Join Bytes.com

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 196,948 network members.
Post your question now . . .
It's fast and it's free

Popular Articles

Top Community Contributors