I have an array of dates in ISO8601 format and need to sort them. Does anyone have a suggestion for an algorithm that would work? I don\'t think they will sort as strings un
I don't think they will sort as strings unless I'm much mistaken,
You are much mistaken :-). They will sort as strings†. That's one of the major plus points of ISO 8601 over other date formats.
See point 1: http://en.wikipedia.org/wiki/ISO_8601#General_principles
... The lexicographical order of the representation thus corresponds to chronological order...
† as long as you aren't dealing with negative years, an you are using the same timezone and subformat i.e. you don't mix month based and week based (thanks to @paxdiablo and @whiskeysierra for pointing these out)