jmr3460 Posted March 20, 2010 Share Posted March 20, 2010 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. Quote Link to comment Share on other sites More sharing options...
Ruzzas Posted March 20, 2010 Share Posted March 20, 2010 I dont understand what your trying to do could you be more clearer? Quote Link to comment Share on other sites More sharing options...
jmr3460 Posted March 20, 2010 Author Share Posted March 20, 2010 I have two dates if first date is less that second date then $variable is 'a', else $variable is 'b'. Quote Link to comment Share on other sites More sharing options...
Ruzzas Posted March 20, 2010 Share Posted March 20, 2010 your $time variable and all its hooked to is the same number as time(); i'd remove that bit and replace it with a time(); Quote Link to comment Share on other sites More sharing options...
jmr3460 Posted March 20, 2010 Author Share Posted March 20, 2010 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.