Dataview: return current day ("Mon", "Tue")

What I’m trying to do

I have a frontmatter field (Day) where I assign a value (“Mon”, “Tues” etc)

I want to query the value from dataview in a daily note.

The following query works and finds the file

table
from "02-School/-Lessons" 
where Week = date(today).weekyear AND Day = "Thu"

I want to generalise the query so it returns the specific day automatically as “Mon”, “Tue” etc for the specific date. I have tried the following and it does not work.

table
from "02-School/-Lessons" 
where Week = date(today).weekyear AND Day = dateformat(date(today), "ddd")

I suspect I am making a fundamental syntax error and would be grateful of help on the error I am making.

Many thanks, Simon

Things I have tried

Searched forum.
Searched web.

1 Like

Hi, I have tried the following code, the first version works the second version does not return any files:

This one works:

table
from "02-School/-Lessons"
where Day = "Fri"

This one doesn’t:

table
from "02-School/-Lessons"
where Day = string(dateformat(date(today), "Ddd"))

expecting Day = string(dateformat(date(today), “Ddd”)) to return a string “Fri”

Any help very much appreciated, many thanks

1 Like

Hello.

I might be barking up the wrong tree, but …

In the truncated diagnostic below, the query works when using the Luxon token EEE for day of the week, as an abbreviate localized string

Does it work with your data and longer query?

***
Day:: Fri
***

# dataview query

```dataview
TABLE 
Day
WHERE date(Day, "EEE")
```

`$=dv.span(dv.current())`

***

Many thanks for your help, will test out, cheers, Simon

1 Like