Can the dateAdd mapper utility also subtract time?
Can the dateAdd mapper utility be used to subtract time? In other words, could any of the integers in parameters 4-9 be negative? Ultimately I would like to input the first of a particular month and go back one day in order to find the date of the last day of the previous month.
Something like this:
java:MapperUitlityClass.dateAdd('2015-12-01 10:10:00', 'yyyy-MM-dd HH:mm:ss', 'MM-dd-yyyy HH:mm:ss', 0, 0, -1, 0, 0, 0)
and the output would be '2015-11-30 10:10:00'
-
That should work, but you will need to add a namespace http://www.w3.org/2001/XMLSchema and bind it with the prefix xs
xmlns:xs="http://www.w3.org/2001/XMLSchema"
Actions > Namespace > Add Namespace
Then, cast the negative number as follows
java:DateUtils.DateAdd('2015-12-01 10:10:00', 'yyyy-MM-dd HH:mm:ss', 'MM-dd-yyyy HH:mm:ss', 0, 0, xs:integer(-1), 0, 0, 0)
Refer to this post for more detail
0 -
You can also enable XSL 2.0
To Select XSL Version 2.0 select "Actions" tab in Data Mapper and select option "XSL Version" and select "2.0" and press "Ok".
0
Post is closed for comments.
Comments
2 comments