Good afternoon all, I hope someone can help me with this.
If I trigger an automation say on Tuesday at 9:00 AM. I can get the date and time for the next business day at the same time (Wednesday 9:00 AM) using {{now.plusBusinessDays(1)}}, but how do I get the next business day plus x hours (Say, Wednesday 10:00AM)?
I tried using a fractional index on the now.plusBusinessDays like {{now.plusBusinessDays(1.25)}} to get Wednesday 15:00 (i.e. a day and a quarter (6 hours) ahead), that doesn't work.
Thanks in advance for any tips.
Hi @Collin Willis , to add business days and hours in an Atlassian automation, you can't use fractions like {{now.plusBusinessDays(1.25)}}
to get a combination of business days and hours. Instead, you'll need to manipulate the date and time separately by adding business days and then adjusting the hours after that.
Here's how you can achieve the desired result in Atlassian Automation:
{{now.plusBusinessDays(1)}}
to get to the next business day.{{now.plusBusinessDays(1).plusHours(1)}}
to add extra hours to the business day.This is an alternative solution that hard codes the time component rather than basing it on the trigger time:
{{now.plusBusinessDays(1).withHour(10).withMinute(0).withSecond(0).withMillis(0)}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
To achieve the next business day plus a certain number of hours in your automation, you can't use fractional indices with now.plusBusinessDays()
, as it only accepts whole day values. Instead, you need to combine now.plusBusinessDays()
with a time adjustment using now.plusHours()
after calculating the business day.
Here’s an approach you can use:
now.plusBusinessDays(1)
.now.plusHours()
.For example, if you want to get the next business day (Wednesday 9:00 AM) and add 1 hour (to get Wednesday 10:00 AM), your formula would look like this:
{{now.plusBusinessDays(1).plusHours(1)}}
This will give you Wednesday at 10:00 AM when triggered on Tuesday at 9:00 AM.
Let me know if you need further clarification or help with more complex time adjustments!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Sorry I reached out too soon. The answer is to use the .plusHours() method.
{{now.plusBusinessDays(1).plusHours(1)}} to return Wednesday 10:00 AM for an automation that launched on a 9:00 trigger on Tuesday.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.