Displaying a message for a time-frame

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
neoaddict
Forum Commoner
Posts: 44
Joined: Thu Jan 12, 2006 12:28 pm

Displaying a message for a time-frame

Post by neoaddict »

How would I echo a message for an hour, or a minute?
I can't just use date/time, right? That would only display it for a second...?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

store the range information for when to display and not display the message.
neoaddict
Forum Commoner
Posts: 44
Joined: Thu Jan 12, 2006 12:28 pm

Post by neoaddict »

What function would I use?

Sorry, I'm just not very good at times. :(
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

No function other than one of the unix timestamp creation functions to generate the timestamps needed (three in all: start, end, and now)
neoaddict
Forum Commoner
Posts: 44
Joined: Thu Jan 12, 2006 12:28 pm

Post by neoaddict »

What is the unix timestamp functions? :( :?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Post by josh »

Use mktime and store it into $start and $end
then use a range

Code: Select all

$show_message = time() <= $end && time() >= $start
var_dump($show_message);
Post Reply