Keyboard Maestro Date Macro
Cool Macros to make Date Calculations Easy.
Every now and again I need to figure out a simple date calculation. For example, I am writing up a wiki page and want to reference something next Thursday. I don't want to say next Thursday but I want to say the simple date format.
I encounter this enough times, that I decided to write a simple Keyboard Maestro macro. There are three types of date scripts that I wrote:
- Simple Date - Display the date x days from now. Added built in for Tomorrow, 2, 3, 4, 5, 7, 30, 60, 90, 100, 180 days
- Advanced Date - Put a number in the Clipboard and use that to display the date.
- Days Until - Put a date in the Clipboard, and then display the number of Years, Months, days until the event. If its in the past, then show the number of days that has past.
This set of macros are built-in date calculations. Simply by using the generic hotkey: day* and some number I can display that date. So if I wanted tomorrow, I would type in day1. If I wanted 100 days from now I would type in day100.
This macro makes use of the ICUDateTimePlus functionality that is part of Keyboard Maestro.
This single macro makes it easy to put in any number of days. Simply type in a number, copy/paste, and then type in day++. This also makes use of the ICUDateTimePlus function. The return display shows the Month, Day, and Year.
This macro is my date count down. If I want to know how many days until an event, I simply type in a date, copy/paste and then type in the trigger: day+++. The return value will show Years, Months, Days, Hours until the event. This also works for events in the past. So I can see how many days past since I graduated.
The PHP secondsToHumanReadable function, used in this example, can be found at stackoverflow.com.