Views:

Question:
How can I use the DateAdd() function in an arithmetic expression to manipulate DateTime variables I have in a workflow?

Answer:
In a workflow, manipulating a DateTime variable, for example, is sometimes necessary to set up a Time Delay step. 
In order to manipulate a DateTime variable, such as adding hours to DateTime for example, we'd use the DateAdd() function to create an arithmetic expression such as the one seen below: 


DateAdd(DateInterval.Hour, Number, DW_FIELD)
NOTE: This will only work for DateTime fields.

  • DateInterval.Hour = This indicates what we're looking to modify from the DateTime. In this case, it's the hours.
  • Number = This indicates the number we want to add to the interval.
  • DW_FIELD = This is the DateTime field that we want to manipulate. 


When this is entered into the arithmetic expressions section, it will add to the hours of the DateTime variable depending on the number given. 

In addition to hours, the following intervals are available to use: 

Day
DayOfYear
Minute
Month
Quarter
Second
Weekday
WeekOfYear
Year

For additional information on DateAdd() function, click here.

KBA is applicable for both Cloud and On-premise Organizations.