I'm getting a date feed which has a format "11/18/2011 12:00:00 PM" or "3/1/2011 10:00:00 AM". As you can see in the format there are no leading zeros for the date.
How do I sort by date with this format?
This is what I have so far
Right now it is sorting by String. "11/13/2011 12:00:00 AM" comes before "2/25/2011 12:00:00 AM". I trying to get "2/25/2011 12:00:00 AM" before "11/13/2011 12:00:00 AM"Code:<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:param name="sortBy" select="'StartDate"/> <xsl:param name="strXPath" select="//Activity"/> <xsl:template match="/"> <xsl:apply-templates select="$strXPath"> <xsl:sort select="*[name()=$sortBy]" order="ascending"/> </xsl:apply-templates> </xsl:template> <xsl:template match="Activity"> <tr> <td><xsl:value-of select="ActivityStartDateTime"/></td> <td><xsl:value-of select="Name"/></td> </tr> </xsl:template> </xsl:stylesheet>



Reply With Quote



Bookmarks