xsl-list
[Top] [All Lists]

RE: [xsl] Comparing dates and ignoring time zone

2006-04-19 05:08:09
Use adjust-date-to-timezone(date, ()) to remove the timezone from the second
date, then compare.

http://www.w3.org/TR/xpath-functions/#func-adjust-date-to-timezone

Michael Kay
http://www.saxonica.com/
 

-----Original Message-----
From: David Murphy [mailto:david(_at_)firechaser(_dot_)com] 
Sent: 19 April 2006 12:28
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Comparing dates and ignoring time zone

I'd like to compare two dates for equality, where the time 
zone of one or other is not considered.

The first date is:

$first = '2006-03-05'

..and the date to compare might be:

$second='2006-03-05T20:00:00.0000000+01:00'

Or

$second='2006-03-05T22:19:43.000Z'

I've tried the following, but it doesn't produce equality: 

<xsl:if test="$first = xs:date(xs:dateTime($second))"> ...
</xsl:if>

Any ideas?

Thanks, David

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>