Setting Email Time Value Based on Current Time - Make.com Guide
Hey there, Make.com users! Today, we're going to tackle a common problem that many of you might have encountered - setting up an 'Email Time' value based on the current time. This might seem tricky at first, but don't worry, we've got a simple solution for you.
Understanding the Problem
Let's say you want to set your 'Email Time' value to '08 AM' if the current time is between '05 PM' and '07 AM'. And if the current time is between '08 AM' and '04 PM', you want to set the 'Email Time' value to the current hour plus 1 hour. Sounds complicated? It's not as hard as it seems!
Step-by-Step Solution
Here's how you can solve this problem:
- First, get the current hour, from 0-23. You can do this by using the following code:
formatDate(now; H)
- Next, you want to do something if the hour of the day is between 8 to 16 inclusive, and something else otherwise. You can do this by using the following code:
if(formatDate(now; H) >= 8 & formatDate(now; H) <= 16; ; )
- If the time is between 8 - 16, you want to set the current hour plus 1 hour. You need to use parseNumber before you perform math operations:
setHour(now; 1 + parseNumber(formatDate(now; H)))
- Output the previous step in your required format (hh A):
formatDate(setHour(now; 1 + parseNumber(formatDate(now; H))); hh A)
- Otherwise, you just want the text '08 AM'
- Finally, combine all the steps above into one variable:
if(formatDate(now; H) >= 8 & formatDate(now; H) <= 16; formatDate(setHour(now; 1 + parseNumber(formatDate(now; H))); hh A); 08 AM)
Troubleshooting Tips
If you're still having trouble, make sure you're using the correct date formats and that you're correctly using the parseNumber function before performing math operations. Also, ensure that you're correctly setting the 'Email Time' value based on the current time.
Conclusion
And there you have it! With these steps, you should be able to set your 'Email Time' value based on the current time. Remember, practice makes perfect, so don't be discouraged if you don't get it right the first time. Keep trying, and you'll get the hang of it in no time!
You do have further questions?
Ask your question via E-Mail: Richard@make-app.de
Book a paid Support & Consulting Session
New Make.com user? Sign up through this Affiliate Link to receive 10.000 operations for FREE.