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. Link to comment https://forums.phpfreaks.com/topic/195898-math-help/ 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? Link to comment https://forums.phpfreaks.com/topic/195898-math-help/#findComment-1029002 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'. Link to comment https://forums.phpfreaks.com/topic/195898-math-help/#findComment-1029005 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(); Link to comment https://forums.phpfreaks.com/topic/195898-math-help/#findComment-1029010 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 Link to comment https://forums.phpfreaks.com/topic/195898-math-help/#findComment-1029013 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.