Page 1 of 1
Problem to sort DATE in a listview
Posted: Fri Jun 16, 2023 8:58 am
by papiosaur
Hello,
i have a problem to sort correctly dates in a listview:

Any idea to correct that please?
Re: Problem to sort DATE in a listview
Posted: Fri Jun 16, 2023 5:01 pm
by plouf
idea n1 is to use "proper" programing date format which is YEAR-MM-DD , that way its "numeric correct" since day is the least significant
i.e. 2023-05-16 (month as two number digit always)
idea n2 is to keep date internal as unix format which is a raw number and react correct to sort, and then "format" it to display to user
i.e. GetTimestamp(#TIMESTAMP_UNIX)
Re: Problem to sort DATE in a listview
Posted: Fri Jun 16, 2023 5:54 pm
by SamuraiCrow
plouf wrote: ↑Fri Jun 16, 2023 5:01 pm
idea n1 is to use "proper" programing date format which is YEAR-MM-DD , that way its "numeric correct" since day is the least significant
i.e. 2023-05-16 (month as two number digit always)
To call that "proper" is to throw locale requirements in the trash and ignore date preferences set in the operating system's control panel.
plouf wrote: ↑Fri Jun 16, 2023 5:01 pm
idea n2 is to keep date internal as unix format which is a raw number and react correct to sort, and then "format" it to display to user
i.e. GetTimestamp(#TIMESTAMP_UNIX)
Now that is the proper way!