|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Date Difference
> I basically have two strings : "9/11/2004" and "10/25/2005" > and would like to produce the number of days between the two. I didn't know there was a month 25. > and would like to produce the number of days between the two. that's not too hard really, you just extract the year month and date components using substring-before and substring after and then calculate the number of days in each case (ignoring leap years) then correct for leap years by comparing y mod 4 - y mod 100 + y mod 400 in each case. (or y-1 if the actual date is in jan or feb) > If that is too difficult it would be OK for me to know if one is equal to > the other ... or maybe if one is equal to, less than or greater than the > other. exctract the three fields as above, format using format-number() so they are two or four digits exactly then concatenate the fields as yyyymmdd and compare the result as integers. XSLT2 has date arithmetic built in but only if you have your dates in a standard format such as 2005-10-25 so even with xslt2 you'd have to use substring (or regexp-replace) originally to get your dates in a standard form. David ________________________________________________________________________ This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








