07.6 Functions (date, time)
Algorithm
Operators in this group ensure the execution of logical operations with operands of the date/time type. The result of the operations is the date.
Result
addMinutes
This operator generates a new date value:
- adding the specified number of minutes to the current date value, if a positive value is specified;
Example: If 3.ValueSV = 2023-01-01T00:00:00Z, then 2023-01-01T00:05:00Z.
- subtracting the specified number of minutes from the current date value, if a negative value is specified.
Example: If 3.ValueSV = 2023-01-01T00:25:00Z, then 2023-01-01T00:20:00Z.
addHours
This operator generates a new date value:
- adding the specified number of hours to the current date value, if a positive value is specified;
Example: If 3.ValueSV = 2023-01-01T00:00:00Z, then 2023-01-01T10:00:00Z.
- subtracting the specified number of hours from the current date value, if a negative value is specified.
Example: If 3.ValueSV = 2023-01-01T12:00:00Z, then 2023-01-01T04:00:00Z.
addDays
This operator generates a new date value:
- adding the specified number of days to the current date value, if a positive value is specified;
Example: If 3.ValueSV = 2023-01-01T00:00:00Z, then 2023-01-02T00:00:00Z.
- subtracting the specified number of days from the current date value, if a negative value is specified.
Example: If 3.ValueSV = 2023-01-01T00:00:00Z, then 2022-12-29T00:00:00Z.
addMonths
This operator generates a new date value:
- adding the specified number of months to the current date value, if a positive value is specified;
Example: If 3.ValueSV = 2023-01-01T00:00:00Z, then 2023-05-01T00:00:00Z.
- subtracting the specified number of months from the current date value, if a negative value is specified.
Example: If 3.ValueSV = 2023-01-01T00:00:00Z, then 2021-12-01T00:00:00Z.
setMinute
This operator generates a new date value by replacing the minutes of the current date with a specified value.
- Example: If 3.ValueSV = 2023-01-31T11:11:00Z, then 2023-01-31T11:05:00Z.
setHour
This operator generates a new date value by replacing the hours of the current date with a specified value.
- Example: If 3.ValueSV = 2023-01-31T11:11:00Z, then 2023-01-31T05:11:00Z.
setDay
This operator generates a new date value by replacing the day of the current date with the specified value. The new day value can be either a number or the name of the day in Latin
If the specified value is in the range from 1 to 7, the resulting date will fall within the current week (from Sunday to Saturday), and the new day will correspond to its ordinal number. If the specified value is outside the range from 1 to 7, the resulting date will belong to the previous or next week.
- Example: If 3.ValueSV = 2023-09-03T00:00:00Z, then 2023-09-10T00:00:00Z.
- Example: If 3.ValueSV = 2023-09-03T00:00:00Z, then 2023-09-04T00:00:00Z.
formatDate
This operator returns the date in the requested format and in the specified time zone if provided.
You can find the list of time zones here.
- Example: If 3.ValueSV = 2023-09-03T00:00:00Z, then 03.09.2023 03:00
parseDate
This operator converts a string into a date in the requested format.
- Example: If 3.ValueSV = 2023-09-03, then 2023-09-03T00:00:00Z.