Skip to main content

Let's say that you have a Zap with any trigger, but you don't want the actions of the Zap to continue until a specific time of day. Perhaps you have an SMS service and you want to send the first message at 12pm after someone signs up, or maybe you want to gather all your new leads that come in throughout the day and send them to yourself at 7am every day.

 

You can't do this with just one Delay step as 'Delay until' requires a specific date as well as time. So - taking the last example - you need one delay for if it's before 7am (to continue the Zap today at 7am) and one if it's after (to continue the Zap tomorrow at 7am).

Thankfully you can do this pretty easily using the Formatter by Zapier app and a couple of paths.

 

After the trigger step, add the Formatter step. Choose to work with Date/Time and then select the Format option.

In the 'Input' field type: {{zap_meta_human_now}}

Whenever you type that in a Zap, it creates a timestamp of whatever date and time it was when the action runs.

For the 'To Format', select 'Use a Custom Value' and in the Custom value box, type HH

 

You can then use the output of that Formatter step to create Path rules that run depending on whether it's before 7am or after.

This is similar to some of the answers to @jesse's question 'How can How can I create a Zap/workflow that only runs during business hours?' though a little simpler as we're only looking at the time of day and not the day as well.

 

I wonder if anyone has a neat way of doing this without using Paths?

 

A code step gets you there without Paths.

Start with a small change to the formatter step:

Screen Shot 2019-09-20 at 17.56.56.png

Then you want this Javascript code step (code to copy/paste below):

Screen Shot 2019-09-20 at 17.58.35.pngtimeNow = output of formatter step

timeUntil = time you're checking against in H format (i.e no training 0, so 9 not 09)

The output will be one of two phrases - in this example:

"17:00" or "17:00 Tomorrow"... which you can then map into your delay stage:

Screen Shot 2019-09-20 at 18.02.54.pngDone 😀

var timeNow = parseInt(inputData.timeNow, 10);

var timeUntil = parseInt(inputData.timeUntil, 10);

if (timeNow < timeUntil) {

return {outcome: timeUntil + ':00'};

}

else if (timeNow >= timeUntil) {

return {outcome: timeUntil + ':00 Tomorrow'};

}



Hi @Danvers,

I recently wrote a post to do this without Paths, and provides a little more customization in an easy way (as code can be tricky). Here’s the link: https://community.zapier.com/tips-and-inspiration-5/make-a-zap-work-between-mon-sat-from-8am-to-6pm-otherwise-delay-1659

 

Cheers,


To accomplish this, I’d use JavaScript to obtain the next workday (Mon-Fri) which is not a public holiday - using the AbstractAPI Holidays API. The pricing is cheap-to-reasonable and the programming is pretty trivial. I’d use that information to feed a date to Delay, and the job is done.

  1. while date is not mon-fri OR abstractAPI for that date returns holiday
    1. increment date (using setDate on the date object)
  2. return date

 


When trying this method, the use custom value option is not available? See attachment

 

Can someone help on this. 

I need the zap to trigger at a specific time of 6pm on any day. 

 

 


Hey @Toby Silent Disco,

It looks as though you’ve already selected the Custom value option so to use a custom format, you’d just need to type in the desired custom format into the To Format field itself: 

db2857f32c27a3fece8c1fd281180d13.png

You can find out more about the supported custom formats here: Customize your date and time options

Adding the Delay steps as mentioned Danvers’ above post won’t prevent the Zap from triggering until 6pm but it will prevent any actions from being carried out until that point. 

Hope that helps! :)


@Danvers if possible, can you fix the hyperlink to “Screen Recording 2018-09-19 at 03.28 PM.mov”? Thank you very much.


Hi @thor1👋

Unfortunately it looks like that video is gone for good, so I’ve removed the reference to it in Danvers’ post. I don’t have another video to replace it with but you can see in the screenshots below how both paths would look as per Danvers’ example:

Path rule to check if the hour value output by the Formatter action is before 7am:
34b7728fbd8f0176dac94faf5cf410ba.png


Path rule to check if the hour value output by the Formatter action is after 7am:
1d265f7ee0c9a4649e868290809706f5.png

You can find more information and instructions on how you’d set up filters/paths in a Zap to only allow the Zap to run during specific times here: Use filters so your Zap only triggers on certain days/times
 

And depending on the desired workflow you have in mind, it may also be worth checking out the following guides on how to delay Zaps from running during certain times:


Hope that helps. Let us know if you run into any issues or questions when setting it up! 🙂


Reply