I may be misunderstanding how you want it sorted, but if you keep the date format you have, you won't be able to sort how you (I think) want.

12-01-08 01-01-07 12-01-06 01-01-98

will sort:

01-01-07 01-01-98 12-01-06 12-01-08

It will sort all the January's first, then all the Februarys, etc... Result will be that January 1998, comes before December 2008, which is not what you want - I'm guessing. If you reverse order, you'd get all the December's first which would make December 2006 come before January 2007. Still not correct.

Have you tried using a different date format - or using Perl to convert the dates you have to a sortable format and then printing them back the way you want?

IMHO, the best way to sort dates would be: YYYYMMDD.


In reply to Re: Sorting by Date Help! by VinsWorldcom
in thread Sorting by Date Help! by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.