Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

query about time

stephen.abiero November 1, 2023

if a ticket is created between 2000hrs and 0700 hrs in project A then create a cloned ticket in Project B 

How can I achieve this automation

I am targeting to solve an issue which is caused by difference in time zones

1 answer

0 votes
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 1, 2023

Hello @stephen.abiero 

 

The basic structure of the rule would be:

Trigger: Issue Created
Condition: Advanced Compare
compare the time portion of now to your time range
Action: Clone Issue

The challenging part is in extracting the time value of now and comparing it to your time range, with consideration for the timezone.

When you look at the date and time returned by the {{now}} smart value, that will be in UTC by default. If you want to convert it to a particular timezone you need to add a function to do that.  Look at the convertToTimeZone function here:

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-date-and-time/

If you then want to extract just the time portion of that value you need to use the format function. Additional codes for formatting dates and times can be found here:

https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html

It looks like you only care about the hour portion of the time.

To get the value converted for a particular timezone and get the time in a 24 hour format that you can compare to your time range you would use a smart value like this:

{{now.convertToTimeZone("Australia/Sydney").format("k")}}

That would return the hour portion of the time as a value 1-24.

You could then compare that value to see if it was greater than 20 or less than 7, and then clone the issue based on that.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events