Jira Misc Calculated Number Field Formula help

David Thompson October 1, 2014

Hi,

I have a working formula in a Calculated Number Field custom field that calculates the minutes between a date and time field and the current date and time.

<!-- @@Formula: (issue.get("customfield_10202")==null ? null : (issue.get("customfield_10202").getTime() - (new Date()).getTime()) / 1000 ) -->

The very simple issue I have is that the result is displayed obviously as a negative value and I need it to be a positive value.

I have tried to reorder the same formula to subtract the date and time field from the current date and time but I get errors in the logs as I'm sure my formula is incorrect.

<!-- @@Formula: (new Date()).getTime()) / 1000 ) - (issue.get("customfield_10202")==null ? null : (issue.get("customfield_10202").getTime() -->

I've looked for examples and tweaked the formula but now run out of ideas.

Thanks.

1 answer

0 votes
David Thompson October 2, 2014

With a bit more thought and testing I used the below formula to get what I needed. No errors in the log so it looks good.

<!-- @@Formula: (issue.get("customfield_10202")==null ? null : (new Date()).getTime()) / 1000 - issue.get("customfield_10202").getTime() / 1000 -->

Suggest an answer

Log in or Sign up to answer