~~~ Please read before posting. ~~~

Important: We need your Club Number at a minimum, and as many details as possible.
For further info please read This page before posting.

Ordering files by date

  • marc33
  • marc33's Avatar Topic Author
  • Offline
  • FreeToastHost Ambassador
  • FreeToastHost Ambassador
  • Posts: 273
  • Thanks: 41

Ordering files by date

7 years 1 month ago
#72594
To create a list of files in file manager that are ordered by date, I tried year, month, day (ex. 2016-10-12 [ISO]) but that didn't work. If you look at the files in the 2017 folder you'll see that I came up with a kludge by entering a letter before the date, but that's cumbersome.

Which date format will put them in proper date order? Going forward, I want to do it correctly.
The topic has been locked.
  • SteveTheTechie
  • SteveTheTechie's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 11526
  • Thanks: 3050

Re: Ordering files by date

7 years 1 month ago - 7 years 1 month ago
#72595
You almost had it right with the 2016 stuff.

You need to use a consistent number of digits for each date part in order for the sorting to work correctly. Use the yyyy-mm-dd format. For example:

2018-01-09
2018-10-12
etc.

Note that I am consistent in the digits above so that the number of characters in the date is always the same.

Also, if you are going to use the date in a file description with other text, you will have better results if you put the date at beginning of the text for the sort to work correctly with this approach. For example, use 2018-10-12 Meeting Minutes, not Meeting Minutes for 2018-10-12. Even if you misspell or change the text part, it still will sort correctly.
Last edit: 7 years 1 month ago by SteveTheTechie.
The topic has been locked.
Moderators: BrianPamrhtaylor3marc33NotLiableNSBjgavinHeniLcala305peterb323DebbieT
Time to create page: 0.136 seconds