Jump to content

Math help


jmr3460

Recommended Posts

I am trying to use an if (){}else{} with time().

$clean = $month."-".$day."-2010";
$time = time($clean);
$number = 1284706800;
if($timeĀ  <= $number){
$registration_money = 30;
}
else
{
$registration_money = 25;
}

The hope is if the $time which is defined by a date selector is less than 1284706800 (which is the time for a specific date at midnight) then the value of $registration = 30 else it will be = 25.

Link to comment
Share on other sites

Thanks for trying. I was not sure what you were saying hooked to. I used strtotime() and did a little different math.

$timed = strtotime($clean);
$cutoff = strtotime("17 September, 2010");
$diff = ($timed - $cutoff);
if($diff > 0){
$registration_money = 30;
}
else
{
$registration_money = 25;
}

Thanks again

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.