Skip to main content
Participant
August 23, 2021
Question

Calculate Number of Pay Periods Between 2 dates

  • August 23, 2021
  • 3 replies
  • 6610 views

I need help a date converting an excel formula to a script usable in Adobe Acrobat Pro DC Custom calculation script.

I need to calculate the number of bi-weekly pay periods between two effective dates excluding Saturdays and Sundays.

 

In excel I use the following formula to calculate the number of pay periods:

=(NETWORKDAYS(StartDate1,EndDate1,0Holidays)/10)

 

I calcultate the number of  workdays (Monday - Friday) between a start and an end date, excluding (Saturday and Sundays), then I divide the number of workdays by 10 to calculate the number of pay periods.

 

Example:

Start Date: 08/20/2021

End Date:  09/02/2021

Calculates to 1 pay period.

 

Thank You

 

This topic has been closed for replies.

3 replies

Participant
March 22, 2023

Hi was this calculation answer I need help creating this exact JavaScript

try67
Community Expert
Community Expert
August 23, 2021

Working with Date objects in JS is not so simple as in Excel. You would need to study this subject and use the various methods available under the Date object to achieve what you described. This is a good place to start:

https://acrobatusers.com/tutorials/working-with-date-and-time-in-acrobat-javascript

https://acrobatusers.com/tutorials/working-with-date-and-time-in-acrobat-javascript-part-2

https://acrobatusers.com/tutorials/working-date-and-time-acrobat-javascript-part-3-3

 

If you're interested, I've developed a (paid-for) tool that does something similar to what you need: It adds a certain amount of days to a starting date (with the option to ignore weekends and holidays) and returns the resulting date. I could easily adjust it for you to do the opposite (ie. count the number of days between two days, ignore weekends and/or holidays). You can find the original tool here:

https://www.try67.com/tool/acrobat-apply-automatic-date-calculation

If you wish to discuss it you can contact me privately via [try6767 at gmail.com].

Amal.
Legend
August 23, 2021

Hi there

 

Hope you are doing well and sorry for the trouble. You need help for date converting an excel formula to a script to be used  in Adobe Acrobat Pro DC Custom calculation script..

 

For more information about using/crreating the cutom scripts please check the help page - https://acrobatusers.com/tutorials/javascript_console/ and see if that works for you.

 

Regards

Amal