10
Well I have an array of objects and I need to sort the one closer to today to further away from today. For example today is day 24/11/2015 there I have in my array the dates:
30/11/2015
27/11/2015
25/11/2015
30/11/2015
In case the result I’m needing is that these dates come like this:
25/11/2015
27/11/2015
30/11/2015
30/11/2015
Inside my array I can date, name, and phone.
I tried to use the sort()
inside this array however didn’t work. Actually I don’t quite understand why sort()
your code is ordering from minor to major date, and other, if you add a date with different month, is only considering the day because you are using
string
:)– Pedro Camara Junior
@Pedrocamarajunior corrected reply, thanks for the tip.
– Marconi