Jump to content

Using DATE in math formula


vbcoach

Recommended Posts

Hello all.

 

Trying this again.  I would like to implement a simple math formula based on a date, but not sure how to do that exactly.

 

I run a sports league, and want to calculate fees based upon a fixed date.  Prior to 'some date' use this calculation, but after this date, add late fees using 2nd calculation.  In my code there are two fields:  $earlyteam and $lateteam.  I need $lateteam to kick in after 'some date'.  Help?

//calculate Fees
  $size = $lSize['size'];
  switch($size)
  {
    case 2: 
         $base = 150;
         $size = 3;
           break;
    case 4: 
         $base = 330;
         $size = 6;
           break;
    case 6: 
         $base = 550;
         $size = 10;
           break;                  
   default: die ("invalid league size");
  };

   $earlyTeam = $base;

   {
     $e_each = $earlyTeam / $pCount;
     $lateTeam = $earlyTeam * 1.10;
     $l_each = $lateTeam / $pCount;
   }  

Link to comment
https://forums.phpfreaks.com/topic/234352-using-date-in-math-formula/
Share on other sites

You can use greater-than/less-than/equal comparisons on dates if the fields making up the date are from left-to-right, most significant field (year) to least significant field (day). YYYY-MM-DD is a commonly used format that will work.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.