Update (2017-10-06, KM8)
This is a KM8 update for the Date Calculator macro from post #1.
I also added an option for a second date format:
You can now define two variables:
- Date Calculator Format 1
- Use this for your most used format, for example your local date format. E.g. Oct 6, 2017 for the U.S.
- Date Calculator Format 2
- Use this for an alternate date format. E.g. 2017-10-06 (ISO) or Week 40 of 2017, etc.
The 'Date Calculator Format 1' variable will be applied if you type "today…", 'Date Calculator Format 2' will be applied if you type "Today…".
So — out of the box — the macro will do this (example):
| Current Date | Typed String | Result | |
|---|---|---|---|
| Oct 6, 2017 | today+2w |
Oct 20, 2017 | [Variable 'Date Calculator Format 1' used] |
| Oct 6, 2017 | Today+2w |
2017-10-20 | [Variable 'Date Calculator Format 2' used] |
The macro contains some predefined examples (in the green group) for each of the variables. Enable/disable and customize them according to your needs.
Date Calculator [KM8].kmmacros (39.7 KB)
PS:
If you don't like the "today"/"Today" keyword you can easily adapt it to your language:
For example, if you prefer "heute"/"Heute" as keyword, then simply change the [tT]oday part of the Typed String Trigger to [hH]eute
You can also prefix the Typed String Trigger with any non-letter character, like ; or ,
So, for example ;[hH]eute[+-]\d+[dwm] would be a valid trigger string.
