Sometimes an automatization should only run when triggered during a specific timeframe. Like you want to enable DND when you plug in your phone, but only when it’s after 21:30 and before 07:30.
In this example I want to show a way how to achieve this.
Let me explain how it works
First, we need to bring the current date and time into a format we can work with.
We will use “HHmmss” as the “Format String” (see Date Format Patterns for Details).
So hours, minutes and seconds without a separator.
This way we can easily use it in an IF-statement.
Make sure to choose the right type (number) for it, otherwise you can’t choose “in between” as an operator of the IF.
And that’s it.
Was this helpful?
0 / 0