Matt Gemmell

TOLL is available now!

An action-thriller novel — book 2 in the KESTREL series.

★★★★★ — Amazon

Days of the week with Alfred 2

code & alfred 4 min read

Following on from my workflow to generate clean filename or URL ‘slugs’ using Alfred 2, I’ve created another one to tell you which day of the week a given date is (or was, or will be).


You can download the Alfred 2 workflow here.

Accepted input

I occasionally need to find out which day of the week (such as Sunday, or Wednesday) a given date will fall upon. Typically, I either open the Calendar application or invoke the Dashboard (with its Calendar widget), but since I use Alfred dozens of times per day, I thought I could probably get the information more quickly with a workflow.

The workflow is triggered with the day keyword by default. Without any additional arguments, today’s day and date will be shown.

Day of Week workflow for Alfred 2

With a single (numerical) argument, two or three results will usually be shown:

  1. That day-number, in the next month in which it occurs (either this month or next).
  2. Additionally, that day-number in the current month (only if it has already passed; otherwise, this suggestion is omitted).
  3. The current day and month, in the year of that number (assumed to be in the current century, unless more than two digits are given).
Day of Week workflow for Alfred 2

The latter case will naturally be assumed if the number is sufficiently large to not be a valid day-number.

Day of Week workflow for Alfred 2

If two numerical arguments are given (regardless of delimiters; feel free to use spaces, slashes, dashes or whatever you like at any time), the workflow will attempt to interpret them sensibly, usually as a day and month.

Day of Week workflow for Alfred 2

The order of the two possible suggestions (day-month, and month-day) depends on your system’s locale. In the UK and Europe, for example, the workflow will assume you specified the day and then the month, whereas in the US the opposite will be assumed.

If the numbers are such that one is obviously a month, it will be interpreted as such regardless of your system’s locale conventions, as in this screenshot taken on a (UK) English system.

Day of Week workflow for Alfred 2

Finally, you can also specify full three-number dates (with either two-digit or four-digit years). In this case, the workflow will strictly assume you are using your locale’s date-ordering conventions, such as day-month-year in the UK or month-day-year in the US (again, delimiters aren’t important).

Day of Week workflow for Alfred 2

Interesting things for workflow developers

There are some points of note that might be useful for those who are creating their own (PHP-based) Alfred 2 workflows, as follows:

  1. This workflow determines the system’s locale, and attempts to localise its output appropriately.

    You can add further localisations by inspecting the workflow’s file-structure on disk (specifically the files in the lang subfolder). Included in the download are English, American English, and very basic French and German localisations.

  2. The calendar/day images shown in Alfred’s results are dynamically generated using gd, a template PNG and a TrueType font. If you add new localisations, suitable calendar images will be created on-the-fly.


If you right-click the workflow in Alfred’s Workflows panel and choose “Show in Finder”, you’ll see its files on disk. Investigate the files in the lang subfolder to see how you can add further localisations, or improve the existing ones.

You can override the auto-chosen locale by double-clicking the “day” script-filter icon in the Workflow’s editing UI within Alfred 2, and following the instructions in the comments there.


Once again, you can download the Alfred 2 workflow here. I hope you’ll find it as useful as I do.

I’m @mattgemmell on Twitter, and mattgemmell on too. You should follow me. If you get some use from this workflow and want to feed my gaming habit (or something else), I have an Amazon UK wishlist.

Enjoy the workflow.