How do I pull information created on or between certain dates?

What I’ve tried

This is what I’ve tried for pulling a list of files created on a certain day… no results are shown but it’s not giving me errors. I’ve definitely created notes on this day.

list file.ctime WHERE file.ctime = date(2022-06-20)
sort file.ctime ASCENDING

And with the same broken logic that didn’t work before… I did this to try and see notes created between certain days

list file.ctime WHERE file.ctime = date(2022-06-20) - date(2022-06-26)
sort file.ctime ASCENDING

I’ve learned how to pull information that has been created after a certain date or before a certain date but not how to pull information that was created on a specific day or between specific days.

What I’m trying to do

I’d like the ability to show a list of files created on a certain day within each daily note. And in weekly/monthly notes, the ability to pull all files created, automatically, during those time periods as well.

I feel like this is a simple query and despite my best efforts I still have not been able to figure it out!

Have you tried using file.cday instead of file.ctime? General investigation strategy when this sort of thing isn’t working: change your list to a table and display any fields you are checking in a WHERE, remove the WHERE and replace with something like LIMIT 10 so your table isn’t huge, and double-check that the things you were trying to compare actually match the format you expect?

Unfortunately this will try to do arithmetic on the dates rather than creating a range. Instead, compare both ends of the range separately, for example:

WHERE file.cday >= date("2022-06-20") AND file.cday <= date("2022-06-26")

If it is capturing files at either end that you don’t want, take out the corresponding = sign and just leave the > or < sign.

1 Like

Thanks, @scholarInTraining! I will try this now. I have not tried file.cday… I didn’t see that as an available implicit data option. I am just starting to learn this and have limited programming skills.

1 Like

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