# Additional Date Functions (v1)

**URL:** https://community.silverbullet.md/t/additional-date-functions-v1/384
**Category:** v1: Troubleshooting (legacy)
**Created:** [April 16, 2024, 4:25am UTC](https://community.silverbullet.md/t/additional-date-functions-v1/384 "2024-04-16T04:25:22Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![terr-steak](https://community.silverbullet.md/user_avatar/community.silverbullet.md/terr-steak/32/192_2.png) [@terr-steak](https://community.silverbullet.md/u/terr-steak)
#### Post date: [July 31, 2024, 2:27pm UTC](https://community.silverbullet.md/t/additional-date-functions-v1/384/2 "2024-07-31T14:27:53Z")

</div>

Adding these here since I use this as well 😉

> [@Calculated dates in queries (templates)](https://community.silverbullet.md/t/calculated-dates-in-queries-templates/136/3):
>
> I wanted to have this to add previous and next buttons to my weekly notes, and came up with this snippet: ```space-script silverbullet.registerFunction("addDays", (date, days) =\> { const plainDate = Temporal.PlainDate.from(date); const offsetDate = plainDate.add(Temporal.Duration.from({ days: Number(days) })); return offsetDate.toString(); }); ``` You can use it like this, [unless you want to pass a negative number](https://github.com/silverbulletmd/silverbullet/issues/691): {{addDays(today, 7)}} Once I have a few more things I think I would pub…

> [@Add "next Sunday" yyyy-MM-DD to your note with a {{next\[Day\]} date function](https://community.silverbullet.md/t/add-next-sunday-yyyy-mm-dd-to-your-note-with-a-next-day-date-function/260):
>
> NextDate Inserter This script adds functions that allow you to insert the yyyy-MM-DD date for the next [day]. e.g. {{nextMonday}} silverbullet.registerFunction({name: "nextSunday"}, () =\> { const currentDayOfWeek = new Date().getDay(); const daysUntilNextSunday = (0 - currentDayOfWeek + 7) % 7; const nextSundayDate = new Date(new Date().getTime() + (daysUntilNextSunday \* 24 \* 60 \* 60 \* 1000)); return `${nextSundayDate.getFullYear()}-${(nextSundayDate.getMonth() + 1).toString().padStart(2, '0…

---

_[View the full topic](https://community.silverbullet.md/t/additional-date-functions-v1/384)._
