Macro for "Next Sunday"

See if this macro (now Ver 2.4) works for you:

2016-12-27 2:28 PM CT

  • Corrected formula for PRIOR Day to be the first day prior to today.

##Macro Library   @DATE Get Date for Prior/Next Day of Week [Example]


####DOWNLOAD:
<a class="attachment" href="/uploads/default/original/2X/0/033924497a09702d1933851cc510c493575481bb.kmmacros">@DATE Get Date for Prior-Next Day of Week [Example].kmmacros</a> (12 KB)

---

### Example Results

If TODAY is Tue, Dec 27, 2016
then the results will be:

```applescript

DayNum Date


-1	Sun, Dec 25, 2016
-3	Tue, Dec 20, 2016
-7	Sat, Dec 24, 2016
1	Sun, Jan 1, 2017
3	Tue, Jan 3, 2017
7	Sat, Dec 31, 2016
```

---

For those that prefer the minimalist approach, see [Ver 2.4.1 below](https://forum.keyboardmaestro.com/t/macro-for-next-sunday/5851/21?u=jmichaeltx).


###ReleaseNotes

Author.@JMichaelTX

**PURPOSE:**

* **Get the Date for the NEXT or PRIOR Day of Week (Sun, Mon, Tue, ...)**

HOW TO USE:

1. Set the Day of Week Number in the magenta-colored Action below
  (1 = Sun;  Negative for PRIOR, Positive for NEXT)
.
2. Trigger this Macro

NOTE: If the Next/Prior Day requested is the same day of week as today, then it wlll return one week from today.

VERSION HISTORY

2.4 2016-12-27 1:55 PM CT

  • Fixed bug in PRIOR Offset. New formula is:
    • (((7 - DOW( ) + ABS(DATE__DayNum)) MOD 7) ) - 7

2 Likes