Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Re: date comparison >Thread Next - Re: date comparison Re: date comparisonTo: NULL Date: 11/21/2007 9:58:00 PM Building on this... I'm trying to compare two dateTimes in an xsl:when test= statement. The logic I need is to compare as follows: xsl:when test="dateTime1 <= dateTime2-(1 hour)" TIA for any help you can offer. "Martin Honnen" wrote: > viklall@g... wrote: > > How do you do a date comparison in xslt? > > XSLT 1.0 does not know about dates. XSLT 2.0 has support for the XML > schema xs:date data type so there you can do e.g. > <xsl:value-of select="xs:date('2007-01-01') > xs:date('2007-07-08')"/> > > With XSLT 1.0 your only chance is to convert the dates to numbers and > compare those e.g. > <xsl:value-of select="number(translate('2007-01-01', '-', '')) > > number(translate('2007-07-08', '-', ''))"/> > > > -- > > Martin Honnen --- MVP XML > http://JavaScript.FAQTs.com/ > | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
