I am having a small issues sorting in my xslt file. I have a date like so: 06/28 05:50 PM. This is what I use to sort it:
The only time things seem to become a problem is at the 12 hour 12 AM should be before 10 AM of course. There doesn't seem to be a way to put logic into the sort function, but is there any way I can make it so this will work properly?
Another way i guess would be to store it in military time and then convert to 12 hr clock later, but it seems like a lot of trouble for something that should be simple.
Anyhow, if anyone can help thank you very much.
David
Code:
<xsl:sort select="substring(date,1,2)" order="descending" data-type="number" /> <!-- month -->
<xsl:sort select="substring(date,4,2)" order="descending" data-type="number" /> <!-- day -->
<xsl:sort select="substring(date,7,2)" order="descending" data-type="number" /> <!-- hour -->
<xsl:sort select="substring(date,10,2)" order="descending" data-type="number" /> <!-- min -->
<xsl:sort select="substring(date,13,2)" order="descending" data-type="text" /> <!-- am/pm -->
The only time things seem to become a problem is at the 12 hour 12 AM should be before 10 AM of course. There doesn't seem to be a way to put logic into the sort function, but is there any way I can make it so this will work properly?
Another way i guess would be to store it in military time and then convert to 12 hr clock later, but it seems like a lot of trouble for something that should be simple.
Anyhow, if anyone can help thank you very much.
David