# Query for dates that are actually links (dataview)

**URL:** <https://forum.obsidian.md/t/query-for-dates-that-are-actually-links-dataview/32628>\
**Category:** Help\
**Tags:** dataview\
**Created:** [February 17, 2022, 10:41am UTC](https://forum.obsidian.md/t/query-for-dates-that-are-actually-links-dataview/32628 "2022-02-17T10:41:29Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![themixx](https://forum.obsidian.md/user_avatar/forum.obsidian.md/themixx/32/7126_2.png) [@themixx](https://forum.obsidian.md/u/themixx)\
**Post date:** [February 17, 2022, 10:41am UTC](https://forum.obsidian.md/t/query-for-dates-that-are-actually-links-dataview/32628/1 "2022-02-17T10:41:29Z")

</div>

Is it possible to query for dates that are actually liks with dataview?

I have 2x data metadata fields that are actally links (`due-date:: [[2022-02-17]]`) and would like to do the following queries on them from within this day’s note:

```auto
WHERE due-date <= date(this.file.name) AND due-date

```

```auto
WHERE due-date = date(this.file.name) + dur(1 day) AND due-date

```

```auto
WHERE due-date >= date(this.file.name) + dur(2 day) AND due-date <= date(this.file.name) + dur(7 day) AND due-date

```

I see the issue coming in where I want to do “calculations” and “comparisons” with the field.

I was thinking of using the `link()`, `string()` and `date()` functions, but the issue comes in with comparing to the value in the actual action.

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![mnvwvnm](https://forum.obsidian.md/user_avatar/forum.obsidian.md/mnvwvnm/32/9766_2.png) [@mnvwvnm](https://forum.obsidian.md/u/mnvwvnm)\
**Post date:** [February 17, 2022, 11:31am UTC](https://forum.obsidian.md/t/query-for-dates-that-are-actually-links-dataview/32628/2 "2022-02-17T11:31:13Z")

</div>

try this:

```auto
WHERE due-date
WHERE date(due-date) <= this.file.day

```

1 - with `date(due-date)` you convert the link (due date is a link) in a date;  
2 - as your files are daily notes with titles in the format “YYYY-MM-DD” you can use the implicit field `file.day`, that extract the date from the file name (attention, to not create any conflict, don’t use any field with the name `Date::`).  
[https://blacksmithgu.github.io/obsidian-dataview/data-annotation/#implicit-fields](https://blacksmithgu.github.io/obsidian-dataview/data-annotation/#implicit-fields)  
3 - you can do the other “calculations” with `file.day`: `WHERE date(due-date) = this.file.day + dur(1day)`  
4 - you can use multiple `WHERE` conditions. They work as multiple “AND”.

---

<div class="post-metadata">

**Author:** ![themixx](https://forum.obsidian.md/user_avatar/forum.obsidian.md/themixx/32/7126_2.png) [@themixx](https://forum.obsidian.md/u/themixx)\
**Post date:** [February 17, 2022, 1:32pm UTC](https://forum.obsidian.md/t/query-for-dates-that-are-actually-links-dataview/32628/3 "2022-02-17T13:32:37Z")

</div>

1 - oh wow thanks. I didn’t think that I could pass the `key` into the `date()` function.  
2 - I also tried `WHERE date(due-date) <= date(this.file.name)` which also worked out for me. I’m not sure how the implicit `file.day` works / where it gets the date from. I see in the docs it’s described as a “An explicit date associated with the file.”  
3 - 👍  
4 - great! I didn’t know that, that certainly cleans up my queries a bit

---

<div class="post-metadata">

**Author:** ![mnvwvnm](https://forum.obsidian.md/user_avatar/forum.obsidian.md/mnvwvnm/32/9766_2.png) [@mnvwvnm](https://forum.obsidian.md/u/mnvwvnm)\
**Post date:** [February 17, 2022, 2:10pm UTC](https://forum.obsidian.md/t/query-for-dates-that-are-actually-links-dataview/32628/4 "2022-02-17T14:10:14Z")

</div>

> [@themixx](#):
>
> I’m not sure how the implicit `file.day` works / where it gets the date from.

`file.day` gets the date from:  
1 - file title if any part have the format `yyyy-mm-dd` (for example: `[[2022-02-17]]`, `[[My file with date 2022-02-17]]`, `[[2022-02-18 Friday]]`, etc.)  
2 - field named `Date` (if you use in your note a field as `Date: 2022-02-18`

A suggestion: use this inline query to check how metadata is structured in your file:

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

```

---

<div class="post-metadata">

**Author:** ![themixx](https://forum.obsidian.md/user_avatar/forum.obsidian.md/themixx/32/7126_2.png) [@themixx](https://forum.obsidian.md/u/themixx)\
**Post date:** [February 17, 2022, 2:37pm UTC](https://forum.obsidian.md/t/query-for-dates-that-are-actually-links-dataview/32628/5 "2022-02-17T14:37:36Z")

</div>

Thanks for the explanation.

OMG that snippet 🤯 is awesome!

---

<div class="post-metadata">

**Author:** ![system](https://forum.obsidian.md/uploads/default/original/3X/b/e/bec35fbd23ab28909bb6bfe62cb32eb82dd34019.png) [@system](https://forum.obsidian.md/u/system)\
**Post date:** [March 19, 2022, 2:37pm UTC](https://forum.obsidian.md/t/query-for-dates-that-are-actually-links-dataview/32628/6 "2022-03-19T14:37:41Z")

</div>

Closed on March 19, 2022, 2:37pm UTC

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