I want to get tomorrows date using exslt date.
date:date()
returns todays date ('2014-01-23') and if I am adding 1 day ('P1D'), I expect it to be tomorrow ('2014-01-24'). But instead the result of
<xsl:value-of select="date:add(date:date(), 'P1D')"/>
is '2014-01-23T23:00:00Z'.
It took me some time of research but finally I solved the problem:
The problem with my previous implementation was caused by the timezone. The exact return value of date:date()
is '2014-01-23+01:00' (a date with timezone; for me it's +01:00).
Adding a duration via date:add(string, string)
seems to have a problem with that. So to get the correct result I just cut off the timezone from todays date. The result of
<xsl:value-of select="date:add(substring(date:date(), 1, 10), 'P1D')"/>
is tomorrows date ('2014-01-24') as expected.