This content has been marked as final. Show 3 replies
Have you seen this post?
Re: Get Date Difference between 2 date values as days
You can do it in XSLT since the dates are in ISO 8601 format...
Here is a sample XSLT...
The above XSLT will result *4* for the following input...
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions"> <xsl:template match="/"> <xsl:variable name="date1" select="xs:dateTime(/root/date1)"/> <xsl:variable name="date2" select="xs:dateTime(/root/date2)"/> <xsl:value-of select="fn:days-from-duration($date2 - $date1)"/> </xsl:template> </xsl:stylesheet>
You can test this example here...
<root> <date1>2012-01-11T00:00:00.000-05:00</date1> <date2>2012-01-15T00:00:00.000-05:00</date2> </root>
Hope this helps...
It is considered good etiquette to reward answerers with points (as "helpful" - 5 pts - or "correct" - 10pts)
Just saw the same post some time back before getting your reply.. Was about to reply on this thread :):)
Just one question though
We are using XSLT 1.0 but to use these functions I changed the version from 1.0 to 2.0 in the XSLT , is this the right way to do it or is there some other way to change version of XSLT and use it.
1 person found this helpful
I changed the version from 1.0 to 2.0 in the XSLT , is this the right way to do it?Yes, that's the way. At least there's no other way that I'm aware of... You may loose the design view though, as JDEV design view only really supports 1.0...