Using arithmetic operations on date and time values

In addition to using the TRUNC and EXTRACT functions, you also can use normal arithmetic operations with date and time values.

The following are the supported operations:
  • Add or subtract a duration to or from a time or a dateTime to obtain a new time or dateTime.
  • Subtract two times or dateTimes to obtain a duration.
  • Add or subtract two durations to obtain a new duration.
  • Multiply or divide a duration by a double number.
  • Divide a duration by a duration.
The following table shows the results of several arithmetic operations on date and time values:
Expression Results
2015-10-05T00:00:00.000Z + P30D 2015-11-04T00:00:00.000Z
2015-10-05T00:00:00.000Z - PT01M 2015-10-04T23:59:00.000Z
23:00:00.000Z + PT02H 01:00:00.00
20:00:00.000Z - PT02S 19:59:58.000Z
2015-01-01T00:00:00.000Z - 2016-12-31T00:00:00.000Z -P365DT0H0M0.000S
23:15:00.000Z - 20:12:30.500Z P0DT3H2M29.500S
P1500DT0H0M0.000S - P500DT0H0M0.000S P1000DT0H0M0.000S
P1DT0H30M0.500S * 2.5 P2DT13H15M1.250S
P1DT0H30M0.225S / 2 P0DT12H15M0.112S
P5DT12H00M0.000S / P1DT0H00M0.000S 5.5