How can I represent tomorrow's date in a template?

I’m using org-roam’s dailies feature to keep track of the time I’ve logged each day. It looks like this:

  (setq org-roam-dailies-capture-templates
      '(("d" "default" entry
         "* %?"
         :target (file+head "%<%Y-%m-%d>.org"
                            "#+title: %<%Y-%m-%d>

#+BEGIN: clocktable :scope agenda :maxlevel 2 :step day :fileskip0 true :tstart \"%<%Y-%m-%d>\" :tend \"%<%Y-%m-%d>\"
#+END: "))))

That works, but only if I manually set the :tend timestamp to tomorrow, by incrementing the day.

What I’d like to do is instead have some magic function %(some-elisp-function-here-for-date "+1") where +1 refers to tomorrow’s date in the form <Y-m-d>, i.e., such that it’s readable by the org clocktable. Is there a way to do that?

org-roam-dailies-capture-tomorrow does this. So I believe something like this below would give you enough to go for what you wish to achieve.

(defun my/date (&optional n)
  (unless n (setq n 1)) ; default is +1
  (format-time-string "%Y-%m-%d" (time-add (* n 86400) (current-time))))
1 Like

Thanks! That did the trick.

1 Like