Skip to main content
Known Participant
May 12, 2017 7:06 PM UTC
Question

calculate total hours between two date fields and two time fields

Hi All.

In my PDF form I would like to calculate total hours between two date fields StartDate and EndDate which formatted like m/d/yyyy. And two time fields StartTime and EndTime which formatted like HH:MM. If StartDate and EndDate are the same so total hours between = 0. If startDate and EndDate are different (5/10/2017 and 5/11/2017) so Total = 7.

For instance:

StartDateEndDateStartTime
EndTimeTotal
5/10/20175/10/201709:0013:004:00
5/10/20175/11/201709:0015:3012:30

How to solve that problem?

Thanks.

This topic is closed to new replies. Start a new post to keep the conversation going.

6 replies

Joel Geraci
Community Expert
Community Expert
May 12, 2017 7:20 PM UTC

I have a free Date library for ACrobat that has a "daysBetween" method that will make that calculation easier.

Link to the library

http://practicalpdf.com/the-practicalpdf-date-library-for-adobe-acrobat/ 

Link to daysBetween

Date - Extended Date Object for Adobe Acrobat

Translate
try67
Community Expert
Community Expert
May 12, 2017 8:06 PM UTC

Doesn't it only do date calculations, not time ones?

Translate
Joel Geraci
Community Expert
Community Expert
May 12, 2017 8:18 PM UTC

It has elapsed time as well. From there you can get hours.

Date - Extended Date Object for Adobe Acrobat

Translate