Round time tracking to the nearest 15 minute Interval
In this video you’ll learn exactly how to round your time to a certain interval.
Watch this video or read the step by step process below. 👇
Are you using time tracking or do you ever want to round time to the next 15 minutes interval?
This blog will show you exactly how you can use Integromat, Integromat functions and automation in general to round to the next 15 minutes interval from a specific time. The goal is rounding to the next 15 minutes value, either round up or round down. This means if the time is 8:55, then it is rounded up to 9:00. If the time is 8:47, then it is rounded down to 8:45. 8:35 gets rounded down to 8:30. So it’s always rounding up or down depending on what is closer to the next 15 minutes interval.
To demonstrate, here’s a sample scenario using a couple of Tools Set Variable modules.
We set the variable value of the Example Time module to 8:55.
In the second module’s variable value, we use Integromat functions to round up or round down the time taken from the first module. And here’s the formula.
As you can see, it looks weird and super confusing. But no worries, we will go through it step by step on how to set it all up.
Let’s break this formula down into individual parts and get into the individual steps: set minute, get mod15, round divided by 15, set new 15 minutes block, and set new time.
1. Example Time
This module gets the time as shown previously.
2. Set Minute
The formula to get the minutes from the example time is:
formatDate(parseDate({Time};h:mm);mm)
The functions operate from the innermost function to the outermost function. Here we first parse the date to get the actual timestamp. We parse it with “h:mm”. This is the code for the time AM/PM. You can find more date and time tokens for formatting if you go to the Integromat date/time formatting page. The tokens are the parameters you can use for formatting date and time. The lowercase “h:mm” is used for the 12-hour timeframe. It would actually make more sense to use the uppercase “H” in this case, because I’m not using AM and PM.
But for demonstration purposes, that is more than enough. Then we use “mm” for minutes with leading zeroes.
After parsing the date, we use formatDate() to format the date and get only the minutes, because that is what we want to work with. This returns 55 from 8:55, having 55 minutes.
3. Get mod15
The next calculation is Minutes modulus 15.
This basically outputs the remainder of the minutes divided by 15. So if you divide 45 minutes by 15, then you get 3 with 0 remainder. If you divide 55 by 15, then you get 3 with 10 minutes remainder. The output here is 10.
4. Round divided by 15
The next step is to round the output after dividing it by 15.
The reason for this is we want to know if we have to round it up or round it down. If the quotient is 0.5 and above, it should be rounded up. If it’s lower than 0.5, it should be rounded down. This means if the output from the previous step is 10, it will be divided by 15 and the quotient is 0.67. That is bigger than 0.5, which means it will be rounded up to 1. If the output is 6, then it will be rounded down. The result is 0.4 and that would be rounded down to 0 . This formula only outputs either 1 or 0 because we’re just rounding it.
5. Set new 15 minute block
The next formula operates on 1 and 0.
This first checks if the output from the previous step, “Round” value, is 1. If it is 1, then we want to round it up. If it is 0, then we want to round it down to the lower 15-minute interval until it’s closer to our time.
The if function has the following syntax:
if({logical expression};{value when expression is true};{value when expression is false})
In our variable value, we layer some functions. First we sum the minutes that we had before.
The sum function has the following syntax:
sum({array of values};sum({value 1};{value 2};{…})
For the value when the expression is true, we sum the “Minutes” variable which is equal to 55 and the 15 minus the “Get Rest” variable from the 3rd module, which is equal to 10. We, then, add that to the actual Minutes. So that is when we want to round it up, because 15 minus the “Get Rest” will be the next 15 minutes interval.
For the value when the expression is false i.e. not equal to 1, we round it down. We use the Minutes and subtract from it the “Get Rest” value. So we use the Minutes, which is 55, then subtract 10 from it, and the difference would be 45. That is our new 15- minute interval we need.
The value of “Round” which is the output from the previous step is 1. This makes the logical expression true, thus, we use the first value in the if statement. We sum the Minutes and the 15 minutes minus the “Get Rest” value. “Get Rest” equals 10. So, 15-10=5. Sum this up with the minutes. That is, 55+5=60. The output is 60. This is the new rounded time at 15-minute intervals.
6. Set New Time
Lastly, reset the time with the new time.
Again, we layer several functions.
We first parse the original time with the h:mm, then we use the setMinute function, where we set the minutes of the time. Only the minutes to a specific time are created here. Then we format the time using formatDate into the h:mm format. This outputs 9:00.
The minutes have been 60, but it automatically calculates the hours, formatting it correctly.
This is the whole magic. Just combine this all into one formula. This is what it looks like.
This is everything inside one text field, layered.
If you want to learn more about Integromat functions, the Integromat functions Cheat Sheet has more than 45 pages of explanations of the functions, how they work, and how you can use them.
As you can see, they are super powerful. Once you’ve mastered them, you can use them anywhere in any text field inside Integromat and they will save you a lot of operations.
Key Takeaway
The quickest way to save operations. In-depth explanation of all available Integromat functions to use various integrations to save your valuable time and resources. Spreading your business across multiple tools and platforms has its benefits, but can also create issues when it comes to the technical side of things. Often you have to settle for choosing between the lesser of two evils and not being able to fully realize your vision due to a lack of technical knowledge or time constraints. One of the most effective ways to really scale up your business is by adopting a platform that connects industrial machines with software. Using a machine-industrial integration tool like Integromat, you can focus on increasing sales instead of growing your team with new in-house IT experts for certain tasks.
What if you could automate your processes like a pro-business? If so, you might be more successful than you’ve ever been before. And wouldn’t it be nice to work with people who already have automated their own business processes? If you need to save time and money by streamlining your business operations, automation can help you achieve your goals but where do you turn for help? Integromasters has just what you’re looking for. Our automation expert will teach you everything you need to know about making the most of process automation technology, including detailed instructions and a Mastermind Facebook Group that is always available to answer all your questions.