View Full Version : PHP - Time Duration help
aussiewarrior
March 10th, 2006, 04:20
Can somebody help me ASAP withe the following:
When a user joins my site they have 24hrs to bid on players. How can I code so that the bid section only stats active for 24hrs then disappears.
Any help would be great.
Cheers
DarkBlood
March 10th, 2006, 14:01
Well, PHP counts time in seconds usually...
and since 3600 seconds equals one hour... you can probably figure out how the script should work from that.
themoose
March 10th, 2006, 14:54
It would be a CRON Job, not just PHP.
Tree
March 10th, 2006, 15:16
No, not necessarily.
$inital_time = whatever the time is now;
if($inital_time-(3600*24) >= 0)
{
not active
}
else
{
active
}
To find out the time now, create a blank PHP file and just have this statement "echo time();" without the quotes.
aussiewarrior
March 10th, 2006, 15:38
No, not necessarily.
$inital_time = whatever the time is now;
if($inital_time-(3600*24) >= 0)
{
not active
}
else
{
active
}
To find out the time now, create a blank PHP file and just have this statement "echo time();" without the quotes.
with initial time does that have to be in seconds???
Also do you need to add a date there so that it knows when it is past the 24hr mark?
stuffradio
March 10th, 2006, 16:34
Yes, cron jobs would be the best for this type of thing
Tree
March 12th, 2006, 13:27
When a user signs up, put the exact date and time in the database. Use an if statement to see if 24 hours has gone by.
Powered by vBulletin® Version 4.1.7 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.