Substract hours from a date with time
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
