Best answer

Can I add business days to a formatter calculation?

  • 23 December 2019
  • 3 replies
  • 2041 views

Userlevel 3
Badge

I need to add n business days to the current date/time in formatter, so I can use that date later in my Zap. Is this possible?


icon

Best answer by PaulKortman 23 December 2019, 20:51

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

3 replies

Userlevel 7
Badge +10

@Martinewski as a person who works in two countries I can tell you that "business days" is a difficult calculation for any international company, Zapier being right in the middle of this mix.

Mostly because holidays are different from country to country, and some countries have bank holidays etc, Plus questions like in the US is MLK Jr a holiday or a business day or both?

So you'll have to look to an outside resource like Workingdays API (paid service)

You'd simply have a webhook step in your Zap using GET as the method. Enter the following URL to add 90 business days to Christmas.

https://api.workingdays.org/1.2/api.php?key=MYPERSONALKEY&country_code=US&command=add_working_days&start_date=2019-12-25&increment=90

You'll need to replace MYPERSONALKEY in that URL and the 2019-12-25 with the date (or value from a previous step) and 90 with the number of days (or value from a previous step).

Just grab  result__end_date for any step afterwards and you'll have the date you are looking for.

Comment here if you need additional help with this.


Userlevel 3
Badge

@PaulKortman I understand your reply. You gave me a perfect solution for the question I made. I'm sorry my question wasn't exactly what I wanted. What I really need is to add weekdays (considering monday-friday).


Userlevel 7
Badge +10

@Martinewski Ha!

Ok a different solution then.. take a look at this blog post basically you could set up a "dummy" or "temporary" google sheet where you input a date value into a cell and another cell uses that value in a "weekday" calculation.

So I'd set up three columns: Date, Duration, Answer in Sheets and put your formula in C2 using the date from A2 and Duration from B2.

Then use a Zapier step to "Update Spreadsheet Row" and choose row number 2 (Row 1 has the column headings in it).

Put your date in the Date cell, and your duration in the Duration cell (via Zapier) and leave the Answer cell empty (in Zapier)

Then the next Zap step would be a "Lookup Spreadsheet Row" Using the Date column and looking up your date (there's only two rows so it's not rocket science for it to find your date) and the result will have all the values including the result of the formula in cell C2/Answer.