Date offsets in queries

Hi, how do I specify a date that’s 10 days prior to today like so:

${query[[
  from index.tag "task"
  where ...
  and scheduled != nil
  and scheduled < date.today()
  and scheduled >= date.today() - 10d
]]}

As far as I know, there is no helper for that in the default library.
You can use os.time() to do some manipulations and then feed that to os.date("%d-%m-%y", yourTimeVariable) like so:

One day = 24 hours, 1h = 60 minutes, 1 minutes = 60 seconds: 1 day = 246060 seconds:
local tomorrow = ${os.date("%Y-%m-%d", os.time() + 24*60*60)}

1 Like

Works great, thank you very much!