How to Sort an Arraylist of Date in ascending and descending order which is in String format

后端 未结 6 1723
轻奢々
轻奢々 2020-12-17 02:36

I have arrayLists of Dates which is in String format then how can I sort this arraylists,

ArrayList aryBeginDate;
ArrayList aryDu         


        
6条回答
  •  我在风中等你
    2020-12-17 03:10

    This will be very painful if you try to sort this yourself with Strings. I'd recommend you to parse the String to a Date (check JodaTime for a very convenient Date/Time tool) and then sort with java.util.Collections.sort().

提交回复
热议问题