– Datetime subtraction operator
Subtracts a number of milliseconds from a DATETIME or a DATETIME-TZ to produce another DATETIME or DATETIME-TZ, or subtracts one DATETIME or DATETIME-TZ from another to produce an INT64 result in milliseconds.
Syntax
datetime
milliseconds
datetime-tz
ExampleThis example returns the date and time exactly 24 hours ago (
dtTime
). It then recalculates the number of hours (iHours
) from the number of milliseconds (iMsec
) since then and displays the result:
Notes
- To get the number of days between two DATETIME or DATETIME-TZ variable values, use the DATE function. For example:
This operation does not take the time portion into account.To ensure the correct result when working with two DATETIME-TZ values, convert one of the values to the time zone of the other. For example:
- To subtract a specific number of days and milliseconds from a DATETIME, use the DATETIME function. For example:
The DATETIME function ensures the time portion remains within a valid range by borrowing a day from the date portion, when necessary.- To subtract a specific number of days and milliseconds from a DATETIME-TZ, use the DATETIME-TZ function. For example:
The DATETIME-TZ function ensures the time portion remains within a valid range by borrowing a day from the date portion, when necessary.See also– Date subtraction operator, + Datetime addition operator, ADD-INTERVAL function, DATETIME function, DATETIME-TZ function, INTERVAL function
OpenEdge Release 10.2B
|