Sorting Dictionary of Strings and Numbers

前端 未结 3 1751
感情败类
感情败类 2021-01-24 18:01

I have a dictionary object that needs to be sorted, but the keys are date values in the form

[\'Apr. 2013\',\'May 2013\',\'Feb. 2013\',
\'Mar. 2013\',\'Jul. 2013\',\'         


        
3条回答
  •  余生分开走
    2021-01-24 18:44

    The DateValue() function is pretty smart about recognizing dates, no matter how crazily they're formatted. It certainly has no trouble recognizing "Apr. 2013" as 4/1/2013. So in your sort routine, instead of comparing the keys, compare their DateValues.

提交回复
热议问题