Jump to content


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


count number of days

Recommended Posts

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

Share this post

Link to post
Share on other sites


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.