Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to display hour and minute in the other custom field?

Fikri Ahmad October 9, 2024

Hi,


I have created 2 custom field for 2 different time :

1. Created Time (Custom field - Date Time Picker)

2. Reported Time (Custom field - Date Time Picker)

3. Result (Numeric Field)

Automation rule created : {{issue.customfield_10134.diff(now).minutes}}

I like to display the result in h:mm:ss. 

What is the right rule to apply?

2 answers

1 vote
Trudy Claspill
Community Champion
October 9, 2024

Hello @Fikri Ahmad 

Welcome to the Atlassian community.

Since Jira does not have a Time/duration custom field, if you want to display a duration in hours:minutes:seconds you have to perform your own calculations to get those values. You can find documentation on math operations with smart values here:

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-math-expressions/

You specified that your Result field in a Number field. You can display only numbers in such a field. You will not be able to add colons to the data format of that field. To display the duration in the format hours:minutes:seconds you'll have to put that information into a Text field.

The diff() function smart value you are using will give you the result in Minutes ( {{issue.customfield_10134.diff(now).minutes}} ). If you want to display that as hours:minutes you'll have to divide the result by 60 to get the hours. You could store that in a variable you create using the Create Variable action. Subtract 60*hours from the diff() result to get the remaining minutes. Store that in another variable you create using the Create Variable action.

You can then concatenate the values in the variables and the colons and store the result in your custom text field; i.e {{varHours}}:{{varMinutes}}

Fikri Ahmad October 10, 2024

Tq Trudy for the explanation.

One more questions.

How about Created Time and Resolved Time generate by the system, can we also calculate for the duration in hours:minutes

Trudy Claspill
Community Champion
October 10, 2024

What is your Resolved Time field? I don't have a Resolved Time field natively in my system, which includes both Jira and Jira Service Management.

There is a native field "Time to resolution" that automatically calculates the difference between the issue Created timestamp and the issue Resolved timestamp, and displays the duration in hh:mm format. However that field is calculated only for issues in Jira Service Management projects. In the below image CUS is a JSD project and ACK is a JSW project.

Screenshot 2024-10-10 at 7.45.59 AM.png

0 votes
John Funk
Community Champion
October 9, 2024

Hi Fikri - Welcome to the Atlassian Community!

What do those two custom fields represent? There is already a Created system field that captures the date and time of when the issues was created. 

Fikri Ahmad October 9, 2024

Actually those 2 field created to calculate the different time (in hour & minutes formatting) between reported time and created time. 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events