Querying year in a date field

EDIT:
I realized that the solution (below) was nonsensical for what I wanted as I was working with relative dates…while I need specific year that doesn’t change if the query is run next year :roll_eyes…so how can I get something like:

WHEN finished (YAML date field like "2022-03-10") contains year "2022" 

EDIT: That’s the solution for relative dates in case could help someone…

I could get it, thanks to a post from @Moonbase59 :slightly_smiling_face:
https://forum.obsidian.md/t/dataview-list-based-on-previous-month/23213/9?u=nestorito

WHERE finished.year = (date(now) - dur(1 year)).year
2 Likes