http://www.perlmonks.org?node_id=1042347


in reply to Re: sorting dates in YYYYMMDD format
in thread sorting dates in YYYYMMDD format

One of the great things about YYYYMMDD is that if you sort it lexicographically you get it properly sorted!
@ordered = sort @dates;

Replies are listed 'Best First'.
Re^3: sorting dates in YYYYMMDD format
by QM (Parson) on Jul 10, 2013 at 09:10 UTC
    One of the great things about YYYYMMDD is that if you sort it lexicographically you get it properly sorted!

    Yes! This is what bugs me about all the international date "standards" -- none of them sort naturally. The only tweak I use is for human readability, YYYYMMmmmDD, where mmm is the 3 letter abbreviation (in the language of choice), which helps the mildly dyslexic distinguish 5 March and 3 May (though maybe that's the hardest one).

    -QM
    --
    Quantum Mechanics: The dreams stuff is made of

      Hos does a date in ISO 8601 format -- YYYY-MM-DDThh:mm:ss (and variations) -- does not sort correctly? Or, by "international date "standards"" did you mean something else?

        "Hos does a date in ISO 8601 format -- YYYY-MM-DDThh:mm:ss (and variations) -- does not sort correctly?" -- self.

        That horrible sentence should have been: "How do dates in ... -- YYYY-MM-DDThh:mm:ss (and variations) -- not sort correctly?".