[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: get Data BETWEEN FromDate and ToDate

Subject: RE: get Data BETWEEN FromDate and ToDate
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 20 May 2005 14:32:32 +0100
date between two dates
> <Employees>
> <Employee Empname="Raj" Empname="Raj" DOJ ="02/04/2005"   
> SftTime="0030"
> >
> <Employee Empname="Rajkumar" DOJ ="02/04/2005"   SftTime="0030"     >
> <Employee Empname="Raja" DOJ ="03/04/2005"   SftTime="0000"     >
> <Employee Empname="Ravi" DOJ ="04/04/2005"   SftTime="2330"     >
> <Employee Empname="john" DOJ ="05/04/2005"   SftTime="1600"     >
> <Employee Empname="gopi" DOJ ="06/04/2005"   SftTime="0100"     >
> <Employee Empname="ajith" DOJ ="13/04/2005"   SftTime="2200"     >
> </Employees>
> 
> i want to filter only employees in DOJ between 05/04/2005 and 
> 13/04/2005
> these date. thatsall.

It looks as if your dates are in the format dd/mm/yyyy, which although more
logical than the form mm/dd/yyyy, still does not sort naturally.

With XSLT 1.0, the technique is to convert the dates to numbers like this:

number(concat(substring(x, 7, 4), substring(x, 4, 2), substring(x, 1, 2)))

and then compare the numbers.

(This is assuming the month and day are always two digits: I shouldn't
really assume that simply because it's true for the six records shown
above).

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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.