Connecting Tech Pros Worldwide Help | Site Map

date periods?

 
LinkBack Thread Tools Search this Thread
  #1  
Old December 22nd, 2005, 09:45 AM
Dave Turner
Guest
 
Posts: n/a
Default date periods?

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, 09:55 AM
Fred Forsyth
Guest
 
Posts: n/a
Default 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, 04:15 PM
NC
Guest
 
Posts: n/a
Default 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

 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

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 220,989 network members.