Posts

Showing posts from January, 2019

XSLT - Modify Date and DateTime value

If you want to perform date and time related opertions with XSLT 'date' or 'dateTime' values, you can use 'xs:yearMonthDuration' or 'xs:dayTimeDuration' function to achieve this. You can add or reduce years, months, date, hours or even minutes through those functions.


 xs:yearMonthDuration

For this function input value is year month duration and it should be passed in ISO_8601 format

n- the [n] is replaced by the value for each of the date and time elements
P - The duration designator(for period).
nY- the number of years. nM- the number of months.
ex: xs:yearMonthDuration('P1Y2M') - 1 Year and 2 Months ex: xs:yearMonthDuration('-P1Y2M') - Negative 1 Year and 2 Months

xs:dayTimeDuration

For this function input value is day time duration and it also needs to be passed in ISO_8601 format

n- the [n] is replaced by the value for each of the date and time elements
P - The duration designator(for period). nD- the number of days. T- The date and t…