• 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

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

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.
 
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.
Hi Arshil, I a, unable to get the date and time format in the requested form. I have tried so many things on the google sheets and nothing works?
 

ArshilAhmad

Moderator
Staff member

Task History ID - IjU3NjUwNTZmMDYzMTA0M2Q1MjZlNTUzNDUxMzI1MTYzNTQzNDBmMzMi_pc

Are you expecting to receive the End Date in this format each time you update data in your spreadsheet and your workflow is triggered?

1739303767975.png
 
Top