• Instructions to Ask a Question

    Click on the "Ask a Question" button and select the application for which you would like to ask questions.

    We have 5 different products namely - Pabbly Connect, Pabbly Subscription Billing, Pabbly Email Marketing, Pabbly Form Builder, Pabbly Email Verification.

    The turnaround time is 24 hrs (Business Hours - 10.00 AM to 6.00 PM IST, Except Saturday and Sunday). So your kind patience will be highly appreciated!

    🚀🚀Exclusive Discount Offer

    Just in case you're looking for any ongoing offers on Pabbly, you can check the one-time offers listed below. You just need to pay once and use the application forever -
     

    🔥 Pabbly Connect One Time Plan for $249 (🏆Lifetime Access) -  View offer 

    🔥 Pabbly Subscription Billing One Time Plan for $249 (🏆Lifetime Access) - View offer

Set a date delay

I want to set up a date delay for a workflow to revoke access to a file.

For example, if a Google Sheets column is updated, I want it to trigger an action which will delay revoke access to a Google Sheets until a certain date (lets say December 30, 2024) What can I do?
 

ArshilAhmad

Moderator
Staff member
Hi @Sneha Varghese,

You can try setting up your workflow in this manner to achieve this use case.

This workflow will trigger when the delay time is updated in your Google Sheets spreadsheet. The delay time will then be passed to the Delay step, which will ensure that the action of removing access to a file is executed after the specified delay.
 

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.
 
Top