Date: Get date of 1st Thursday Next Month

Hi!
How can I have Shortcuts help me get the (relative) date of the 1st Thursday of next month? I’m hoping to then use that date as a variable throughout the rest of my shortcut. Thanks!

I think this should do it.

Hope that helps.

Thank you, @sylumer! For some reason, it seems to pull up Nov 1st when I run this shortcut.

I do think I was able to come up with a solution; I’ll post it here shortly. But it has some limitations–if I run the shortcut too close to the beginning of next month, it won’t necessarily work; it’s using the “Next Thursday” language. This isn’t a problem for me–at that point I’d already be missing deadlines, so using this to set up my project deadlines in OmniFocus wouldn’t be as helpful.

I also didn’t bother to extend it out more than 4 weeks ahead (although it’s possible for a month to have 5 Thursdays) because for my purposes, I wouldn’t be running this shortcut until at least one week into the month.

How about this one?

You may need to change the number of days on the last action depending on what you use as first day of the week - Sun or Mon

Have you made any modifications? It doesn’t return that for me. Currently it has consistently been giving the 5th November.

Here’s the algorithm that the shortcut should be following (assuming I created it correctly).

  • The Shortcut takes the current date and gets the first of the current month.
  • It then adds one month to get the date of the first of next month,
  • It then gets the numeric day of the week value for that first of the month date (Monday = 1, Tuesday = 2, etc.)
  • It subtracts that value from the Thursday position value (4), and if negative then adds 7. So the mapping should be:

Monday : 4-1 = 3 => add three days to the start of the month.
Tuesday : 4-2 = 2 => add two days to the start of the month.
Wednesday : 4-3 = 1 => add one day to the start of the month.
Thursday : 4-4 = 0 => add zero days to the start of the month.
Friday : 4-5 = -1 => 7 + (-1) = 6 => add six days to the start of the month.
Saturday : 4-6 = -2 => 7 + (-2) = 5 => add five days to the start of the month.
Sunday : 4-7 = -3 => 7 + (-3) = 4 => add four days to the start of the month.

  • The resulting figure is then applied as a days adjustment to the start of next month date.
  • The adjusted date is then returned.

Maybe I’m overlooking something in the logic, but it seems to me that this should return the correct date for the first Thursday of next month.

1 Like

Can confirm it is working correctly for me as well. (iOS 14.0.1 public release).

1 Like

@sylumer, thank you for explaining the logic for your shortcut! It still was returning Nov 1st (maybe my app has a bug?) but I was able to build the same shortcut as yours from scratch and it’s working! Thank you for such a clean solution!