Dataview created dates query not working consistently for me

What I’m trying to do

I am using Dataview and my queries work well EXCEPT when I want to list items on today’s date or in the last day or two.

Things I have tried

Here is the simplest query where the list is taken from a folder called “@CAPTURE” to show today’s additions:

LIST
FROM "@CAPTURE"
WHERE date=(today)

The expression…

WHERE file.mtime >= date(today) - dur(1 day)

…seems to work but if I look at file.mtime in a TABLE the results are not like a date and time. Results for all files and ates are shown as the same:

2024-38-06-08:38

You seem to have typos in your post so it’s not very clear what you actually use for the date in your selection. Like what do you mean with date = (today), are you trying to compare against a date property? Or are you just missing to write date(today)? Or should there be something like file.mtime?

Then again the result you’re presenting says “2024-38-06-08:38”. Is this supposed to be a date? Which format is that? It’s not ISO 8601, at least.

Finally, if you’re using file.mtime you should either switch to file.mday or striptime(file.mtime) to get rid of the timestamp from your full date. And you might need to do file.mday.ts and date(today).ts when comparing for equality.

1 Like

Helpful tip about removing the timestamp — I didn’t know how to do that:

I did show some alternatives I was trying on the journey.

That was my question! I couldn’t work this out, nor understand why each ‘date’ was the same. Hoping someone with familiarity with Dataview and iots ways, can point to an answer.

Well, you need to answer the questions I asked. And you need to tell us more about what you want, and what your file names are.

We’re not mind readers.

Holroy said:

Blockquote You seem to have typos in your post so it’s not very clear what you actually use for the date in your selection. Like what do you mean with date = (today), are you trying to compare against a date property? Or are you just missing to write date(today)? Or should there be something like file.mtime?

Yes, trying to compare against a date property (as “What I’m trying to do”, above)

Then again the result you’re presenting says “2024-38-06-08:38”. Is this supposed to be a date? Which format is that? It’s not ISO 8601, at least.

It should be a date and I would expect a date. The format is a mystery. And also why every entry is the same. As already stated, this is the essence of my question.

Finally, if you’re using file.mtime you should either switch to file.mday or striptime(file.mtime) to get rid of the timestamp from your full date. And you might need to do file.mday.ts and date(today).ts when comparing for equality.

I have already commented, with thanks, for this suggestion

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