954,568 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Calculating number of days between dates

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

Any help would be greatly appreciated

f_atencia
Junior Poster in Training
54 posts since Aug 2009
Reputation Points: 10
Solved Threads: 4
 

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.

fpmurphy
Junior Poster
147 posts since Oct 2008
Reputation Points: 22
Solved Threads: 11
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You