This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Compare Dates
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: RE: [xsl] Compare Dates
- From: "Julian Reschke" <julian dot reschke at gmx dot de>
- Date: Tue, 12 Jun 2001 12:07:33 +0200
- Reply-To: xsl-list at lists dot mulberrytech dot com
> From: owner-xsl-list@lists.mulberrytech.com
> [mailto:owner-xsl-list@lists.mulberrytech.com]On Behalf Of Michael Kay
> Sent: Tuesday, June 12, 2001 11:55 AM
> To: xsl-list@lists.mulberrytech.com
> Subject: RE: [xsl] Compare Dates
>
>
> > I want to compare two dates to find out which comes first.
> > 2000-12-19
> > What I donīt want to do is to compare each number, if I validate the
> > formate is there a XSL function to see which date comes first??????
>
> If the dates are in ISO format just strip the hyphens and compare as
> numbers:
>
> xsl:if test="translate($date1, '-', '') < translate($date2, '-', '')"
Note however that this won't work properly if the ISO date contains trailing
time zone information...
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list