Time Based Shortcut

I need to run a shortcut when I connect to CarPlay but not if the time of day is after 4 pm. The shortcut works great but I can’t figure out how to add the “time of day” constraint. Thanks for any input.

So this turned out to be easier than I thought. I can’t figure out how to share the full shortcut, but here’s a screenshot of the key part. It should let you do something similar in your shortcut. The key is that the Get Dates From Text action turns out to be smart enough to know what “today” means, and the date conparison’s current date seems to include time.

Awesome. Thanks so much. I’ll update my shortcut and see how it works.

If you want to share a shortcut choose at the bottom of your edit screen for the square box with an arrow pointing up. And choose for copy icloud link.

1 Like

Thanks! Very helpful

1 Like

Works. Now the text is only sent before 4pm on weekdays.

1 Like

For future reference and anyone else who wants a is-it-before-or-after-some-time shortcut, here it is.

https://www.icloud.com/shortcuts/e86f007bb62a4ebcb5f028699b85f1bd

Enter the comparison time in the text field at the top. It uses the current date and time, and I’ve modified the original to also show if it happens to be exactly the comparison time (4 pm in OP’s request), though I haven’t tested that functionality.

This could obviously be adapted to all sorts of uses, and could be turned into a kind of subroutine that accepts a date or time in text and returns a Boolean result