This might not be helpful, since you may not have control over the input you receive, but I feel compelled to comment on your choice of date formats.
I have found it useful to always use date format "YYYYMMDD", which has the following advantages:
- numeric sort, lexical sort, and chrono sort are
the same
- ordering of units by size (years => months => days) are internally consistent, and consistent with our standard number representation
- consistent with ISO standard date formatting
Just a thought.