• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers

Substract hours from a date with time

New Here ,
Apr 23, 2021 Apr 23, 2021

Copy link to clipboard

Copied

Hello,

 

I would like to calculate the time of the beginning of a treatment, depending on a date and  time of a medical exam selected in a field

For example, I select in the fiedl "Date exam" that the exam will be on the 2021/05/31 12H30

so the time for beginning the treatment will be calculated : 12H30 - 6H = 6H30

I don't need to see the date in the result, only the time. The date of the exam with time is written for information at the top of the prescription, this is why I don't use only a time.

I would like also  to add or not an additionnal delay of 2 hours, depending on the answer of a radio button "Delay" (yes or not)

the calculation would be : "Exam date" - 6 hours - (2 hours if Yes, 0 hours if Not).

 

I am not familiar with java script and I searched among forums and could not find a precise answer and examples.

 

Thank you very much

TOPICS
Acrobat SDK and JavaScript

Views

45

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 25, 2021 Apr 25, 2021

Copy link to clipboard

Copied

LATEST

Read these tutorials to learn how to do time calculations in Acrobat JS:

 

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

 

I've developed some (paid-for) tools that will allow you to set up such calculations quite easily, without having to write any code yourself (such as: https://www.try67.com/tool/acrobat-calculate-time-differences-in-a-worksheet), but it seems your situation is more unique and will require a custom-developed solution. If you're interested in hiring someone to do it for you feel free to contact me privately via [try6767 at gmail.com] to discuss it further.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines