Ordering based on a specific date format

Hey hey everybody :waving_hand:

Is it possible to order content by date, but with dates separated by hyphens?

By configuring num as follows in the blueprint, here is what I achieve:

num: "{{ page.date.toDate('YmdHi') }}"
.
β”œβ”€β”€ 201911151606_c4q14
β”œβ”€β”€ 201911210541_ag8fe
β”œβ”€β”€ 201911210548_ap737
└── 201912051126_mxn8v

I would like to achieve something like this.

.
β”œβ”€β”€ 2019-11-15-16-06_c4q14
β”œβ”€β”€ 2019-11-21-05-41_ag8fe
β”œβ”€β”€ 2019-11-21-05-48_ap737
└── 2019-12-05-11-26_mxn8v

But if I try this configuration, I can’t do it.

num: "{{ page.date.toDate('Y-m-d-H-i') }}"

or

num: "{{ page.date.toDate('Y') }}-{{ page.date.toDate('m') }}-{{ page.date.toDate('d') }}-{{ page.date.toDate('H') }}-{{ page.date.toDate('i') }}"

Kirby expects the sorting number to be a number, therefore slashes won’t work.

@texnixe Thank you for the response, in fact it makes a lot of sense.

Just a quick question. Is it possible to add the seconds? When I try to add them s, I always get a result of 00.

num: "{{ page.date.toDate('YmdHis') }}"

I get folder name like this.

20250404110500_slug
            ^^
            ||       
       always `00`

Probably because the date is saved like that? Check out the date and time settings to make sure you have the correct setting to allow seconds in the date (if you haven’t yet).