Hi all,

I have 2 xsl variables (currentBillDate and lastBillDate), both having access to dates in format of yyyy-mm-dd.
How can I calculate the number of days in between both days?

Example: 2006-08-28 - 2006-11-06

I tried it this way but it kept giving me NaN

<xsl:value-of select="$currentBilldate - $lastBillDate" />

Any help would be greatly appreciated

If you are using XSLT1, the easiest way is to use the date:difference() in EXSLT. If you are using XSLT2 the subtraction of two dates gives a xs:dayTimeDuration which a ISO 8601 truncated format PnDTnHnMnS, where nD represents the number of days, T is the date/time separator, nH the number of hours, nM the number of minutes and nS the number of seconds.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.