Dataview query for notes created in a specific day and week

Things I have tried

LIST from "000 Inbox" where contains (creation_date: <% tp.date.now("yyyy-MM-DD) %>

This is the frontmatter used for the query:

creation_date: <% tp.date.now(“yyyy-MM-DD HH:mm”) %>

“000 Inbox” was the inbox folder, but I’d like to search for notes from the entire vault.

What I’m trying to do

Query notes created on a specific day and week. (I’d like to know how to do that for quarterly, monthly and yearly too.)

To start, you need to know what is the proper format to dataview recognize the value as a date.
https://blacksmithgu.github.io/obsidian-dataview/annotation/types-of-metadata/

I guess the output of <% tp.date.now("yyyy-MM-DD HH:mm") %> is something like 2022-12-13 11:15, a value that is not recognizable as date (in ISO format a date-time need to be like 2022-12-13T11:15.

So, or you change the inputed format or you need to “build” a date inside dataview query code with the string in creation_date

Only after some domain about the basic you can explore other things.

1 Like

I tried simply adding “T” inside the template syntax. I guess that’s not so banal… So it seems Templater and Dataview use other ISO date formats. Does that mean it’s impossible to achieve what I want using these two plugins?

And I’m not technical enough to understand that, sorry.

I’m not sure (because I rarely use Templater), but I guess Templater uses generic moment.js format and Dataview a particular ISO8601.

Once you outputted a valid date format to dataview - something like 2022-12-13T16:15 -, then you can start to explore the dataview queries…

I can give you this query…

LIST
WHERE striptime(creation_date) = date("2022-12-13")

… but you need to spend some time reading docs and learn all the stuff related with it (not only the syntax, but how metadata works in background).

You’re definitely right. I’ll do that.

I did try the query you gave me, but as you can see here, something doesn’t seem to work: https://imgur.com/a/gQGCZeW

Can you help?

Edit: I moved WHERE under LIST, and removed the “T” but still no results.

Screenshot 2022-12-13 at 17.35.21

It’s what I’m doing until now!

Not “will do”, you need to do it now, when you need a solution!

If you want a “direct” interpretation of the value as a date-time metadata, you need to use 2022-12-13T16:15, not 2022-12-13 T16:15. Are two different things, right?

I appreciate your help. I will go through the docs before asking a dataview question from now on.

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