Jump to content


Photo

count number of days


  • Please log in to reply
No replies to this topic

#1 klinmy

klinmy
  • Members
  • PipPipPip
  • Advanced Member
  • 33 posts

Posted 09 February 2006 - 11:40 AM

i would like to calculate working days (except for friday and saturday) between 2dates. how should i do?

<?
   $today =  $end_date;

   $pastdate = $start_tarikh;

   $explodetoday = explode("/", $today);

   $stoday = mktime(0, 0, 0, $explodetoday[1], $explodetoday[0], $explodetoday[2]);

   $explodepastdate = explode("/", $pastdate);
   $spastdate = mktime(0, 0, 0, $explodepastdate[1], $explodepastdate[0], $explodepastdate[2]);

   $sDifference = $stoday - $spastdate;
  
   $total= ($sDifference / 60 / 60 / 24 ); 
?>

it works well to count the number of days without considering friday and saturday are offdays.
wht should i add on in above code inorder to count only days except for friday and saturday? thx






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users