Now I’ve moved from TextExpander to Alfred and am creating new extension text snippets in Alfred, I encounter questions to solve dynamic content of snippets. Particularly with dates. Alfred’s dynamic snippet possibilities for dates are somewhat limited of themselves. Finding this tip from 2017 in the Alfred forum by one of the admins and following her pointer to this overview of unix date format patterns was very helpful.

Where Alfred only looks at the date and things relative to it, with those patterns you can do anything, as long as you remember Alfred starts from the date itself.

So getting the week number is {date: w} and last week’s number is {date -7d: w} (todays date minus 7 days, -1w won’t work). And getting the things like Q4 is {date: qqq}.

I use these snippets to create dynamic links in my Obsidian note files. E.g. I have a weekly review note, which ends with a link to the previous and the next weekly review file. The file names are along the lines of ‘W 2020-43 Review’. I create links dynamically with Alfred using the snippet, with the dynamic parts between {}:

[[W {date -7d:YYYY-w} Review | previous week review]]  [[W {date +7d:YYYY-w} Review | next week review]]