This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: sorting by date
- To: xsl-list at lists dot mulberrytech dot com, kmcnally9 at hotmail dot com
- Subject: Re: [xsl] sorting by date
- From: Steve dot Ball at zveno dot com
- Date: Tue, 23 Oct 2001 14:27:45 +1000
- Organization: Zveno Pty Ltd
- References: <F60laoY99EXxt5BBBVh0000d0fb@hotmail.com>
- Reply-To: xsl-list at lists dot mulberrytech dot com
Katie McNally wrote:
>
> The format of the dates returned in my XML is 17-Dec-2000 07:23:32. I need
> to display dates as 12/17/00. I am formatting the dates I display by
> calling the following template:
[...snip...]
The XSLT Standard Library, http://xsltsl.sf.net/, has a date-time
module which includes a template for formatting dates.
> I am displaying the dates in a table. The table can be sorted by the user
> by clicking on the column titles. I am able to sort the table for all of
> the non-date columns, but do not know how to sort the table by date.
What it does *not* include is a way of parsing dates. You have to do
that yourself :-(
Get your dates into ISO format: YYYYMMDDHHMMSS. For example,
20011023141400
(2:14PM, 23rd October 2001). The date value can then be treated as an
integer
for sorting purposes. Use the date module in XSLTSL to get it back into
a human-readable form.
Cheers,
Steve Ball
--
Steve Ball | XSLT Standard Library | Training & Seminars
Zveno Pty Ltd | Web Tcl Complete | XML XSL Schemas
http://www.zveno.com/ | TclXML TclDOM | Tcl, Web Development
Steve.Ball@zveno.com +---------------------------+---------------------
Ph. +61 2 6242 4099 | Mobile (0413) 594 462 | Fax +61 2 6242 4099
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list