Sort Dataview by frontmatter time

What I’m trying to do

I have a simple dataview in my daily note to list meetings that took place during the day. As I sometimes create meetings at different times I wanted to use my own frontmatter to specify the date and time the meetings take place as opposed to the meta data of the note.

Here’s my dataview

list FROM "2 - Work/Meetings" 
WHERE date = striptime(this.file.day) 
SORT time ASC

I think the problem is my time format. I use 12hr format, so for example 2:00 PM. I’ve looked around at how to change the format but couldn’t find anything that matched my case.

You’re not showing us any base/example data so you’re leaving us to guess whether the apple is equal to an orange or a goat…

1 Like

Here is an example of one of my notes.

project::
participants::
summary::
time:: 11:30 AM

I want to sort by time. Earliest to latest.

Thanks

You could try to use in your query:

SORT date(time, "h:mm a") ASC

or

SORT date(time, "hh:mm a") ASC

… Depending if you use 0 padded hours (as in 02:00 PM) or non-padded hours (as in 2:00 PM) :blush:

1 Like

Thank you! Works perfect.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.