Connecting Tech Pros Worldwide Help | Site Map

date periods?

  #1  
Old December 22nd, 2005, 10:45 AM
Dave Turner
Guest
 
Posts: n/a
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  
Old December 22nd, 2005, 10:55 AM
Fred Forsyth
Guest
 
Posts: n/a

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.

  #3  
Old December 22nd, 2005, 05:15 PM
NC
Guest
 
Posts: n/a

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

Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Finding specific date ranges kyosohma@gmail.com answers 10 September 7th, 2007 11:45 PM
Overlapping Date Periods George1029 answers 6 November 1st, 2006 01:15 PM
How to group date periods together ? James Conrad StJohn Foreman answers 7 July 9th, 2006 08:55 AM
Date Problem - How to identify working days only BlackFireNova answers 5 November 12th, 2005 03:41 PM