xsl-list
[Top] [All Lists]

Re: [xsl] how to compare dates

2011-12-20 03:39:34
XSLT 2.0 supports a wide range of functions and operators on dates, but it expects them to be in ISO format (YYYY-MM-DD). You can easily convert your dates to this format using combinations of the substring() and concat() functions. So something like

test="xs:date(my:format-as-ISO(ItemDueDaye) > xs:date('2000-01-01')"

On the other hand if you're using XSLT 1.0 then it's often simplest to convert the date 20110101 to the number 20110101 and do a numeric comparison.

Michael Kay
Saxonica

On 20/12/2011 09:29, henry human wrote:
Hi
I want to compare  to dates with each other:
ItemDueDate which has YYYY-MM-DD format  and the 20110101.
When the ItemDueDate is bigger than 20000101,I fill two leading zero in the 
result and display the result in 00YYYYMMDD format.
Thanks for any help
Henry


--~------------------------------------------------------------------
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>