Getting the date of “next Friday”

whatsnew
km8

#1

Keyboard Maestro 8 extends the ICUDateTime token to let you find things like “next Friday” or “three Saturdays from now”.

The ICUDateTimePlus and ICUDateTimeMinus can add a number of seconds, hours, minutes, days, weeks or years to the current time, so for example:

%ICUDateTimePlus%6%Days%yyyy-MM-dd%

will give the date 5 days from now.

Keyboard Maestro 8 lets you alternatively specify Mondays, Tuesdays, Wednesdays, Thursdays, Fridays, Saturdays, Sundays to add.

Adding 0 Sundays will give the next Sunday, possibly today (0 to 6 days from now). Adding 1 Sunday will give the next Sunday, definitely not today (1 to 7 days from now). Adding 2 Sundays will give the next next Sunday (8 to 14 days from now).

So if today is Monday the 30th of October 2017, then:

%ICUDateTimePlus%0%Mondays%yyyy-MM-dd% ➤ 2017-10-30 (today)
%ICUDateTimePlus%1%Mondays%yyyy-MM-dd% ➤ 2017-11-06 (7 days from now)
%ICUDateTimePlus%0%Wednesdays%yyyy-MM-dd% ➤ 2017-11-01 (2 days from now)
%ICUDateTimePlus%1%Wednesdays%yyyy-MM-dd% ➤ 2017-11-01 (2 days from now)
%ICUDateTimePlus%2%Wednesdays%yyyy-MM-dd% ➤ 2017-11-08 (9 days from now)

So you can use this to easily calculate the next desired weekday.

So, for example, if I want to use a date for my invoices that always gives at least 21 days, but is always due on a Thursday, I can use:

%ICUDateTimePlus%4%Thursdays%yyyy-MM-dd%

That will always be between 22 and 28 days in the future, on a Thursday (currently 2017-11-23).


Insert Time Question In Different Time Zone
#2

Peter,

Exactly what I was looking for!!!

Thanks for a great product and support.