# Query Based on Month

**URL:** https://community.silverbullet.md/t/query-based-on-month/457
**Category:** General
**Created:** [May 23, 2024, 11:20am UTC](https://community.silverbullet.md/t/query-based-on-month/457 "2024-05-23T11:20:06Z")
**Posts on this page:** 1
**Showing post:** 3

<div class="post-metadata">

### Author: ![ethan](https://community.silverbullet.md/letter_avatar_proxy/v4/letter/e/8dc957/32.png) [@ethan](https://community.silverbullet.md/u/ethan)
#### Post date: [June 7, 2024, 11:53pm UTC](https://community.silverbullet.md/t/query-based-on-month/457/3 "2024-06-07T23:53:58Z")

</div>

Someone previously posted a few [additional date functions](https://community.silverbullet.md/t/additional-date-functions/384), including one that returns the current month:

```space-script
silverbullet.registerFunction({name: "monthNumber"}, () => {
  return Temporal.Now.plainDateISO().month;
})

```

If you go ahead and add a `month` attribute to your tasks (e.g., `[] Something to do [month:6]`, you could render tasks where that `month` attribute matches the current month:

```template
{{{task where month = monthNumber render [[Library/Core/Query/Task]]}}}

```

I prefer to see tasks in the next 30 days though, so I’m comparing `addDays(today, 30)` with the `deadline` attribute in the following template:

```template
{{{task where !done and deadline <= addDays(today, 30) order by deadline render [[Library/Core/Query/Task]]}}}

```

---

_[View the full topic](https://community.silverbullet.md/t/query-based-on-month/457)._
