Skip to main content
April 27, 2022
Question

How to add hours to a given date

  • April 27, 2022
  • 5 replies
  • 0 views

We are having a start date Eg. "2022-04-22 18:10:03"(Datatype: Date & Time) . I need to add 5 hours to the date and should provide me result as "2022-04-25 14:10:03".

Requirement: Should not include time between 19:01(7:01 pm) to 9:59(am) and week end (Saturday & Sunday).

Explanation: 4th April is Friday and the time given was 18:10(6:10pm). Total time taken is 50 min to complete 7pm on 4th April. As 23rd and 24th comes under week ends (Saturday & Sunday) we need to remove those date and time. Then we need to add date from 25th10:00am resulting in adding 4 hours 50 min on 25th.

5 replies

harshitb6843
April 27, 2022

now()+intervalds(5,0,0)

harshitb6843
April 27, 2022

And to only add working hours

caladdhours(now(),5)

April 27, 2022

Thank you Harshit. This code works well with the calendar working hours that is existing with Appian. Is there any way we can change the working time/dates for that particular year and hence forth. The version we are using is 21.1.