We can use the xp20:subtract-dayTimeDuration-from-dateTime(String1, String2) function to subtract duration of String2 from String1 time.
For example:
To subtract one day
xp20:subtract-dayTimeDuration-from-dateTime(xp20:current-date(), 'P1D')
To subtract 2 hours from the current date time
xp20:subtract-dayTimeDuration-from-dateTime(xp20:current-date(), 'PT2H')
To subtract one day 2 hours
xp20:subtract-dayTimeDuration-from-dateTime(xp20:current-date(), 'PD1DT2H')
The following example query adds a dayTimeDuration value equal to 1 day, 2 hours, 30 minutes, and 5 seconds to a date Time value equal to the date: January 1, 2003 and time: 1:00 AM as shown in the following query:
The resulting date Time value equal to the date: January 2, 2003 and the time: 3:30:05 AM is returned as shown in the following result:
No comments:
Post a Comment