Jump to content

calculate absent days


ramiwahdan

Recommended Posts

Hi,

I need to calculate absent percentage but not sure how. working days from Sunday to Thursday every week so 5 working days a week. i will calculate the absent days from joining date until current date. Example if joining date is 24-3-2020 and today's date is 7-4-2020 i should get the number of absent days to 11 days since both Friday and Saturday are excluded. How to do that?

here is what I have:

$workingdays = $curdate - $joindate;
$workingdays = $workingdays - 				
$absent = ($counter / $workingdays) * 100;

the second line i missing the number of days for (Fridays and Saturdays) that should be excluded from calculations. The third line i did calculate the actual working days ($counter) for the employee so then i can get percentage of absent days. How to exclude the weekend days from calculations?

Edited by ramiwahdan
mistake in dates
Link to comment
Share on other sites

How accurate do you need to be?

Over a period of time, working days = total days * 5 / 7.

If you need absolute accuracy then you need the data on when they attended (or were absent) for every occurrence since they joined. Do you have that data?

If you do have the data, then this is essentially the same problem as your other post about absent days.

Link to comment
Share on other sites

8 hours ago, Barand said:

How accurate do you need to be?

Over a period of time, working days = total days * 5 / 7.

If you need absolute accuracy then you need the data on when they attended (or were absent) for every occurrence since they joined. Do you have that data?

If you do have the data, then this is essentially the same problem as your other post about absent days.

yes it is for the same db of absent days, so i build on the fpdf file that generates the absent days.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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