addtimeunit
These functions return a time by adding a specified number of time units to a time.
addseconds, addminutes, and addhours
-
addseconds(time_expr, no_of_seconds, [work_schedule_name_expr], [use_cutoff_expr]) -
addminutes(time_expr, no_of_minutes, [work_schedule_name_expr], [use_cutoff_expr]) -
addhours(time_expr, no_of_hours, [work_schedule_name_expr], [use_cutoff_expr])
- time_expr
- An expression of type time.
- time_units
-
The number of time units that represent the amount of time to be added to time_value. For example, for the addseconds function, this parameter is the number of seconds to be added. To compute a past time relative to time_value, pass a negative number for this parameter.
If you enter a float value for this parameter, such as 5.4 or 27.9, only the integer part of the number is used. For example, 5.4 becomes 5.
- work_schedule_name_expr
- Optional. The name of a work schedule within the region. An empty string indicates that no work
schedule is specified. The function throws a runtime exception if other parameters expect a work
schedule.
If a work schedule is specified, the function uses the work schedule to calculate the returned time (instead of the default 24x7 schedule). That is, the returned time always falls within the work schedule, and only hours that are within the work schedule count in terms of the calculation.
- use_cutoff_expr
- Optional. Whether the function is to use the cutoff time on the work schedule as part of the calculation for the returned time. The function throws a runtime exception if the value of this parameter is true and no work schedule is specified.
addhours(Entry_time, num_hours)adddays, addmonths, and addyears
-
adddays(time_value, time_units, time_expr, no_of_days, [work_schedule_name_expr], [day_adjustment_expr], [use_cutoff_expr]) -
addmonths(time_value, time_units, time_expr, no_of_months, [work_schedule_name_expr], [day_adjustment_expr], [use_cutoff_expr]) -
addyears(time_expr, no_of_years, [work_schedule_name_expr], [day_adjustment_expr], [use_cutoff_expr])
- time_expr
- An expression of type time.
- time_units
-
The number of time units that represent the amount of time to be added to time_value. For example, for the adddays function, this parameter is the number of days to be added. To compute a past time relative to time_value, pass a negative number for this parameter.
If you enter a float value for this parameter, such as 5.4 or 27.9, only the integer part of the number is used. For example, 5.4 becomes 5.
- work_schedule_name_expr
- Optional. The name of a work schedule within the region. An empty string indicates that no work
schedule is specified. The function throws a runtime exception if other parameters expect a work
schedule.
If a work schedule is specified, the function uses the work schedule to calculate the returned time (instead of the default 24x7 schedule). That is, the returned time always falls within the work schedule, and only hours that are within the work schedule count in terms of the calculation.
- day_adjustment_expr
- Optional. The day adjustment option. After the returned work day is calculated, this option determines the returned work day time.
- use_cutoff_expr
- Optional. Whether the function is to use the cutoff time on the work schedule as part of the calculation for the returned time. The function throws a runtime exception if the value of this parameter is true and no work schedule is specified.
The algorithm for the addmonths and addyears functions might differ from the way that comparable calculations are made in various development environments.
addmonths(convert("01/31/1997 12:00:00", time), 1)addyears(convert("02/29/2000 12:00:00", time), 1)| Example | Meaning |
|---|---|
| adddays(systemtime(), 2) | The function uses the default 24x7 schedule to calculate the returned time by adding two days to the current time and day. |
| adddays(systemtime(), 2, MyWorkSchedule) | The function first determines whether to adjust the start time. The function uses the specified work schedule to calculate the returned time by adding two work days to the current time and day. |
| adddays(systemtime(), 2, MyWorkSchedule, “End_Of_Day”) | The function first determines whether to adjust the start time. The function uses the specified work schedule to calculate the returned time by adding 2 work days to the start time. The returned time of day is 11:59 PM. |
| adddays(systemtime(), 2, MyWorkSchedule, “End_Of_Day”,true) | The function first determines whether to adjust the start time. For more information, see
Work schedule
|
| adddays(systemtime(), 2, “”, “End_Of_Day”) | The function uses the default 24x7 schedule to calculate the returned time by adding two days to the current time and day. The returned time of day is 11:59 PM. |