• Instructions to Ask a Question

    For any assistance, please click the "Ask a Question" button and select the Pabbly product for which you require support.

    We offer seven comprehensive applications designed to help you efficiently manage and grow your business:

    Our support team endeavors to respond within 24 business hours (Monday to Friday, 10:00 AM to 6:00 PM IST). We appreciate your understanding and patience.

    🚀 Exclusive Lifetime Offers 🚀

    We invite you to take advantage of our special one-time payment plans, providing lifetime access to select applications:

    • 🔥 Pabbly Connect — Lifetime Access for $249View Offer
    • 🔥 Pabbly Subscription Billing — Lifetime Access for $249View Offer
    • 🔥 Pabbly Chatflow — Lifetime Access for $249View Offer

    Make a one-time investment and enjoy the advantages of robust business management tools for years to come.

Holding a step until business hours

Status
Not open for further replies.

nicheweb

Member
Your Task History ID
none yet
How can I make it so the next step of my workflow doesn't execute until it's between the hours or 9 and 5pm during the week? I've done this a couple other ways on other platforms. Thanks!
 

ArshilAhmad

Moderator
Staff member
Hi @nicheweb,

Holding a particular step to execute only during specific hours is currently not possible. However, you can use Pabbly Connect Manager to start your workflow at 9 AM and stop it at 5 PM. Please check out the thread shared below to understand how you can do so.
https://forum.pabbly.com/threads/time.15949/#post-75509

You would need to create two new workflows—one to enable and another to disable your original workflow.
 

nicheweb

Member
The only problem with this is that if it receives something outside of business hours, the flow will never happen. I believe I have a way to accomplish this so I will report back once I have that configured.

In regards to feedback, it would be nice to be able to put "a weekday" and other similar options in the delay until step.
 

HRIM

Member
sample java code you can use the pabbly code feature -- to determine if the current time is in business hours, if not how many minutes to add to a delay step before business open time.

function getPacificTime() {
var now = new Date();

// Determine Pacific Time offset based on current date for DST (PDT or PST)
var isDST = now.getMonth() > 2 && now.getMonth() < 10; // Simple DST check (March to October)
var pacificOffset = isDST ? -7 : -8;

// Adjust UTC time to Pacific Time
var pacificTime = new Date(now.getTime() + pacificOffset * 60 * 60 * 1000);
return pacificTime;
}

function getBusinessAdjustedTime() {
var pacificTime = getPacificTime();
var pacificHour = pacificTime.getHours();
var pacificMinutes = pacificTime.getMinutes();

// Business hours: 9 AM - 6 PM
var startHour = 9;
var endHour = 18;

var nextOpen = new Date(pacificTime);
var diffMinutes;

if (pacificHour >= startHour && pacificHour < endHour) {
// Within business hours, 0 minutes until next opening
diffMinutes = 0;
} else {
// Calculate time until next business opening
if (pacificHour >= endHour) {
// Move to the next day at 9 AM
nextOpen.setDate(nextOpen.getDate() + 1);
}
nextOpen.setHours(startHour, 0, 0, 0);

// Calculate the difference in milliseconds
var diffMs = nextOpen - pacificTime;
diffMinutes = Math.floor(diffMs / (1000 * 60));
}

// Output two variables
var currentTime = pacificTime.toLocaleString('en-US');
return { diffMinutes, currentTime };
}

// Run the function to get the result
var result = getBusinessAdjustedTime();
var minutesUntilNextOpen = result.diffMinutes;
var currentDateTime = result.currentTime;

return { minutesUntilNextOpen, currentDateTime };


The code outputs two separate variables—minutesUntilNextOpen and currentDateTime that you can use.
 
Status
Not open for further replies.
Top