cancelar
Mostrando resultados para 
Pesquisar então 
Você quer dizer: 

sort date

 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?

0 Kudos
Mensagem 1 de 7
4.111Exibições

Its always good to share code(VI)/Code snippet, Nothing can be understood by attaching image of FP.

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
0 Kudos
Mensagem 2 de 7
4.110Exibições

 

DateSorting.png 

Try this, May be others can suggest easy conversion.

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
Mensagem 3 de 7
4.104Exibições

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

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Mensagem 4 de 7
4.102Exibições

sd.png

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Mensagem 5 de 7
4.066Exibições

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/

0 Kudos
Mensagem 6 de 7
4.055Exibições

My solution is similar to Paul's.  It just avoids the conversion back into a string.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Mensagem 7 de 7
4.040Exibições