Skip to main content
Participant
December 20, 2019
Question

Need a Script to calculate weeks between two dates in fillable form

  • December 20, 2019
  • 1 reply
  • 1651 views

Hi,

 

I need some help with a script to generate the amount of weeks between two dates in a fillable form. I need the formula to work with the fillable form as they the dates will be different each time.

Im trying to get the amount of weeks to calculate from the two fillable areas in order to have the amount of hours per week in a project to calculate.

 

I have attached what it looks like so far to help.

 

Your help will be greatly appreciated!

 

 

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
December 20, 2019

Maybe start by posting the script you already have...

Participant
December 22, 2019

Hi,

 

I don't have any script at the moment. I've done alot of googling, but cant find anything that seems to work.

 

try67
Community Expert
Community Expert
December 23, 2019

OK. The way to do it is to convert both date strings to Date objects then calculate the difference between them in milliseconds, using the getTime method. Then you can convert that value to days or even directly to weeks.

See these tutorials for more information:

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