Problem to sort DATE in a listview

Discuss GUI programming with the RapaGUI plugin here
Post Reply
papiosaur
Posts: 217
Joined: Fri Mar 31, 2023 1:34 pm

Problem to sort DATE in a listview

Post by papiosaur »

Hello,

i have a problem to sort correctly dates in a listview:

ImageImage

Any idea to correct that please?
plouf
Posts: 666
Joined: Sun Feb 04, 2018 11:51 pm
Location: Athens,Greece

Re: Problem to sort DATE in a listview

Post 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)
Christos
SamuraiCrow
Posts: 475
Joined: Fri May 15, 2015 5:15 pm
Location: Waterville, Minnesota USA

Re: Problem to sort DATE in a listview

Post 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!
I'm on registered MorphOS using FlowStudio.
Post Reply