Need help for dataview with HH:mm

What I’m trying to do

I want to use dataview to display a list of files, using a custom formatting for the date property, fetched from the YAML front matter of the independent files.

The front matter is input into a template that is using the date: { date:YYYY-MM-DD HH:mm } YAML format. This works, showing a date such as date: 2023-10-16 22:47

When querying dataview, and using dateformat(), to make the custom formatting, no instances (that have the HH:mm) are displayed.

Things I have tried

  • By manually adding the “T” to date, as such 2023-10-16T22:47, dataview successfully displays the files. I have not been able to escape/insert this “T” into my template.
  • Removing HH:mm from the template also works, but I liked the condensed way of writing this, removing one extra (time) line from my front matter.

Are there better ways to do this, or do I need to remove the minutes and seconds to get it to work?


The best way is indeed to add that extra “T” into the format, and if I’m not mistaken that means to use date: {{date:YYYY-MM-DD[T]HH:mm}} in your templates. See here for a list of all options available.

However, there exists also other options:

  • Define the format in the settings for Templates, and then just use {{date}} in your templates
  • Use the two parameter variant of date() with a suitable format, to read your non-conformant date as a proper date within dataview
  • Use regexreplace() to insert the missing “T” before other operations

As long as the “T” is missing this field is not recognised as a date by dataview, which furthermore indicates that dateformat() doesn’t work on it. At least not as long as you’ve not interpreted it as a date by some of the means above.

1 Like

Hi, @holroy

I tried your trick of inserting the T using [T], and it worked perfectly. Thanks!

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