# 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:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![adamsih300u](https://community.silverbullet.md/letter_avatar_proxy/v4/letter/a/a9adbd/32.png) [@adamsih300u](https://community.silverbullet.md/u/adamsih300u)
#### Post date: [May 23, 2024, 11:20am UTC](https://community.silverbullet.md/t/query-based-on-month/457/1 "2024-05-23T11:20:07Z")

</div>

New Silverbullet user here, I’m quickly falling in love with this tool.

I use monthly checklists in order to keep track of items I have to do regularly throughout the year. I can implement these as tasks within a file easily enough.

On my index page, I thought it would be great to have a live query of the tasks for the current month. I was hoping to use the ‘Today’ function and pull out the number of the month, and then either transform that to a month-name and match off a month-name tag, or just tag the various tasks with the month number and use that without any transformation.

Does that look like it could be possible, and what would the query look like? I’m not a huge SQL / developer type, so I’ll be excited if I can learn something new.

Thanks!  
Adam

---

<div class="post-metadata">

### Author: ![cliffordx](https://community.silverbullet.md/user_avatar/community.silverbullet.md/cliffordx/32/335_2.png) [@cliffordx](https://community.silverbullet.md/u/cliffordx)
#### Post date: [June 6, 2024, 5:11pm UTC](https://community.silverbullet.md/t/query-based-on-month/457/2 "2024-06-06T17:11:46Z")

</div>

i have the same question.

---

<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]]}}}

```
