A template, triggered once each day (at midnight) with a condition test before action.

```
{{now().strftime('%j')|int()%10==0}}
```

The %j returns the day in the year, %10 returns the remainder, which will be 0 only every 10 days, hence only ‘true’ every 10 days.

This works for any number n of days, starting at the nth day. Naturally it will not overlap the end of the year correctly, going from day 360 to day 10 of the new year.

To make this more rigorous we can use Unix timestamp, reduced to an integer number of days in the epoch.

```
{{ utcnow().strftime('%Y-%m-%dT%H:%M:%SZ') | as_timestamp | int() // 86400 %10==0 }}
```

Using UTC time rather than local time will for many places result in a test at midnight using the day prior, but since we are looking for every 10 days, not a specific day, this should not matter.

The strftime format just gets the timestamp into something that as_timestamp will accept, then // does an integer truncate division to get days in the Unix Epoch.

Of course, the %10==0 can be changed to ==1 to ==9 if you want to synchronise to a given date (eg your birthday, or the day you bought the toothbrush), and the 10 can be changed to anything you like, so do “this” every “x” days!

Since you are interested in every 10 days, and since months are (almost) 30 days long, we can simply test just on the day of the month. To avoid short months like February, every (say) 5th, 15th, 25th of the month is going to be 10 days (or 11 or 8/9) apart

```
{{now().strftime('%-d')|int() in [5, 15, 25]}}
```

Returns true accordingly for the 5th, 15th and 25th of the month.

This is a useful way of setting up automations for bills and such that fall on the same *day* of each month. Naturally, such conditional logic can be extended to, for example, switch a routine from 3 times a month during the winter, to 5 times a month during the summer.