Subject: Re: [xsl] Date Difference From: thomas.maciejewski@xxxxxxxxx Date: Mon, 19 Dec 2005 14:56:30 -0500 |
Do you have these functions written somewhere? Tom Maciejewski Sociiti Ginirale Information Technology 1221 Avenue of the Americas New York, NY 10020 Tel. (212) 278-7103 Cell. (917) 690-9541 David Carlisle <davidc@xxxxxxxxx To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > cc: Subject: Re: [xsl] Date Difference 12/19/2005 01:11 PM Please respond to xsl-list > 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 ________________________________________________________________________ ************************************************************************* This message and any attachments (the "message") are confidential and intended solely for the addressees. Any unauthorised use or dissemination is prohibited. E-mails are susceptible to alteration. Neither SOCIETE GENERALE nor any of its subsidiaries or affiliates shall be liable for the message if altered, changed or falsified. *************************************************************************
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Date Difference, Rudolf P . Weinmann | Thread | RE: Re: [xsl] Date Difference, cknell |
Re: [xsl] Date Difference, Chris Burdess | Date | [xsl] How to call a stylesheet from, Woods, Christopher |
Month |