Calculate difference from two date time picker

Kristian Koniarz November 13, 2020

Dear Community,

I am a newbie and searching a solution to calculate the total time in hours and min from two date time pickers. One represents Start the other the End.

StartDate = 10.10.2020 4PM

EndDate = 11.10.2020 3:30PM

Result = 23:30

Goal is to automatically calculate the time difference and store it an another field.

In case on of you have an answer or even the same problem I would appreciate any information which could help me. I used the search function already but couldn´t figure out there to set scripts etc.

Best,

Kristian

2 answers

2 votes
Katerina Kovriga _Stiltsoft_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 13, 2020

Hi @Kristian Koniarz ,

You may try the Table Filter and Charts for Confluence app and its Table Transformer macro.

Wrap your table in the Table Transformer macro and add the following custom SQL query:

SELECT T1.'Start Date',
T1.'End Date',
DATEDIFF(hour, T1.'Start Date', T1.'End Date') as 'Result'
FROM T1

Fri 2-1.pngFri 2-2.pngThen you need to set an appropriate Date format for the case:

Fri 2-3.pngNow you can preview the result:

Fri 2-4.pngHope this will help your case.

Kristian Koniarz November 13, 2020

Thanks for your time and suggestion @Katerina Kovriga _Stiltsoft_,

Unfortunately I am not authorised to purchase new plugins. Still checking the web through inbuild script solutions.

Best,

Kristian

1 vote
Daniel Ebers
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 13, 2020

Hi Kristian,

I came across such requirement for calculation of a duration. We used "Jira Workflow Toolbox" with a formula like this:

%{Resolution} != null ? shortFormatDuration({End Date} - {Start Date}) : (%{Resolution} = null ? shortFormatDuration({Current date and time} - {Start Date}) : %{Resolution})

The last part is only to calculate against the current time in case the resolution is not yet set (meaning: the issue is still 'running'). You might need to adjust it according to your needs even in case you would go with Jira Workflow Toolbox.

Cheers,
Daniel

Kristian Koniarz November 13, 2020

Thanks for your time and suggestion @Daniel Ebers 

Unfortunately I am not authorised to purchase new plugins. Would it be possible to implement a logic as you described with the help of an script? Which can be set inline during the workflow.

Best,

Kristian

David Fischer
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 13, 2020

Which plugins do you have on your instance? Without any plugin (app), Jira doesn't offer any scripting.

Kristian Koniarz November 16, 2020

Hello @David Fischer

so far I got MyGroovy and thought it could be realised with this software.

In case it wouldn´t cover my needs I need to drop my question.

Best,

Kristian

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events