Jump to content

Recommended Posts

Generate relative dates based on a simple input format and your own date formatting parameters (there are some default placeholders you can delete).

Supports multiple locales/languages.



Get the workflow from GitHub.


  • date — Generate a formatted date using the [input format][]
  • — Copy date to clipboard
  • ⌘+↩ — Copy date to clipboard and paste into frontmost app
  • datehelp — Open the help file
  • dateformats — View saved date formats
  • ⌘+↩ — Delete date format
  • dateadd — Add a new date format
  • — Save the date format
  • datereset — Reset the saved date formats to the defaults

Input format

(+/-)<NUM>(w|d|y) where w = week(s), d = day(s) and y = year(s)

You needn't specify a sign: + is understood as the default, so +1d and 1d mean the same thing.

Months are not supported, as it leads to ambiguity: what if today is the 31st, but the target month only has 30 days? Similarly, a year is naively defined as 365 days.


  • 0 = now = today — today's date
  • 1d — 1 day from now
  • 7d = 1w — 1 week from now
  • -21d = -3w — 3 weeks ago

Supported formats

The Workflow includes a few defaults for the locales en_US, en_GB and de_DE.

You can specify your own custom date formats using the formatting options listed at the below links, and you can also specify a language with the format lang=de or lang=de_DE if you want to use dates formatted for a language different to your system's.

For a list of the formatting options, please see the GitHub page or the Packal page.


  • %d/%m/%Y — e.g. 21/01/2014
  • %A %B %d %Y — e.g. Wednesday March 12 2014
  • %A %d. %B %Y lang=de — e.g. Mittwoch 12. März 2014

Bug reports, feedback

Report any issues or feature requests either on GitHub or in this thread.

Licensing, thanks etc.

This Workflow is released under the MIT Licence.

It uses the docopt library.

Edited by deanishe

Share this post

Link to post

This is great.


Any chance you could add a way to calculate the number of days between dates?


eg. it's 04-Apr and I want to know the number of days between 21-Mar and 10-Apr.

Share this post

Link to post

Calculating the days between two dates has nothing in common with this workflow code-wise (this one cannot understand dates, for example), so no, that's very unlikely.

Share this post

Link to post

Hi. Great Workflow!


I have two questions:


My Mac computer uses EN_US as the default locale, but all my work is done in spanish. Is there anyway I can change the default locale to spanish?

Also, does the Workflow supports time?



Thank you!

Share this post

Link to post

No, you can't set a default locale. You'll have to set all your formats individually using lang=es (or whatever).

As soon as you've added one custom format, you can delete all the default ones (if you delete all the formats, the defaults will be re-added).

The workflow doesn't currently support time, but I might consider adding it if there's sufficient demand for it.

Share this post

Link to post

I'm getting dates in en_US style even though I should be getting en_UK ones; `locale` in the terminal shows en_GB and the main language setting is United Kingdom. Is there something that I need to do to get the workflow to pick this up?

Share this post

Link to post

Alfred doesn't use your shell environment, which is what you see when you run locale or echo $LANG in Terminal.
The workflow takes its default locale from your system settings with defaults read -g AppleLanguages (it grabs the first result).
On my system, which has the preferred language set to "British English", I get:


Either change your Preferred languages in System Preferences under Language & Region so that "British English" is at the top, or append lang=en_GB to each of your formats, e.g:

dateadd %x lang=en_GB

 will give you 19/06/2014. 

The Region you have set in Language & Region is ignored, as a lot of users have it set to where they live but have their system set to use English/British English. This results in unusable locales like en_DE or de_IT.

Edited by deanishe

Share this post

Link to post

Thanks. After checking with `defaults read -g AppleLanguages` I discovered that I didn't have British English set as my language at all, but only the region as United Kingdom. Once I changed that everything was fine, as you might expect.

Share this post

Link to post

Basically the same thing as this but using time:


Have multiple time formatting selections like you have date formats here.


Allow for time calculations like "now 36h" to show 36 hours from current time,etc. To be honest this seems like it would be less useful with time but who knows.

Share this post

Link to post

I'm just popping my head into this thread to let you all know that in the next Alfred release (3.4), there'll be date arithmetics added to snippets, making it possible to calculate dates (e.g. {date +7d +3h:long} to paste the date seven days and three hours from now in long format)


While @deanishe is very generous with his time, this might be a case where it's worth waiting til the next pre-release - of course, unless Dean fancies adding that to the workflow as well, as it's a convenient way to add these on the fly! :)




Share this post

Link to post
10 minutes ago, Vero said:

unless Dean fancies adding that to the workflow as well


No plans to spend any time on this workflow at the moment, tbh. I rarely use it any more.

Share this post

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...