Create file based on day of the week

I want to create a macro that, when invoked, takes the current day of the week and: if it is a Sunday, opens a file called foo-yyyymmdd.md (ex: foo-20160731.md) using the current date. If not a Sunday, it opens a file called foo-yyyymmdd.md using the upcoming Sunday’s date.

I’m thinking there’s a more elegant way than 7 “if” statements using %ICUDateTimePlus%0%Days%e%

If you want to learn more about handling date/time in Keyboard Maestro, see:

###Example Macro
This has had very, very limited, testing. Test and confirm for yourself before using in production.

####MACRO: [Dates] Generate File Named Based on Day of Week [Example]

[Dates] Generate File Named Based on Day of Week [Example].kmmacros (4.8 KB)

###Example Results

Perfect, thanks. I had the places in the documentation…I was just way overthinking the math!

1 Like

Geat! Good to hear.

BTW, if my post solves your problem, please check the box at the bottom of my post that says “This reply solves my problem”, so that others will know.