09-20-2018 01:54 AM
Hi all ,
i am having the dates like 5/29/2018 in array ( month / date / year ) [ reading from the access database ]
i need to sort the dates in a correct order . used sort array option , but not getting in a right order. pls, see attached image here .
any other options?
09-20-2018 02:00 AM
Its always good to share code(VI)/Code snippet, Nothing can be understood by attaching image of FP.
09-20-2018 02:22 AM - edited 09-20-2018 02:31 AM
Try this, May be others can suggest easy conversion.
09-20-2018 02:26 AM - edited 09-20-2018 02:27 AM
They are ordered as strings. You need to convert strings to Timestamps before sorting, using Scan From String with format string %<%m/%d/%y>T
09-20-2018 08:34 AM
09-20-2018 10:35 AM
Easiest way if you have control is to start with dates in ISO 8601 format. Then you can just remove the "/" and sort as numbers.
Reference: https://xkcd.com/1179/
09-20-2018 12:51 PM - edited 09-20-2018 12:52 PM
My solution is similar to Paul's. It just avoids the conversion back into a string.