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

I am trying to round a number that is calculated by subtracting today from a future date.

Shevondalyn Robinson September 5, 2024

I'm creating a report in which the number of days until expiration must be calculated. The calculation works fine. The rounding does not.  Here is what I have: date1, date2 and expDays.

date1 - set value to [now]

date2 - future date

expDays - number of days between 

([entry.date2.timestamp]- [now])/86400000

I tried rounding by adding the function to the expression:

(ROUND([entry.date2.timestamp]- [now])/86400000, 2)

I also tried using field definition rule to round after the calculation (ROUND([entry.expDays], 2))

None of the above worked. I tested the ROUND function by using numbers in the place of dates and it didn't work with numbers either. Trying to figure out what I'm doing wrong in attempting to use the ROUND function.

2 answers

Suggest an answer

Log in or Sign up to answer
1 vote
Sravan Indukur September 5, 2024

HI @Shevondalyn Robinson ,

If you are using this date format in Jira, you can use Jira smart values. The below link might be helpful for you.

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

 

  • {{now}} // returns 2020-08-18T02:40:37.0+0000
  • {{now.jiraDate}} //returns 2020-08-18

 

Prashanth Sripuram September 9, 2024

Hi @Sravan Indukur 

Good morning,

The solution provided by you was it helpful? your response will be much appreciated.

1 vote
Tuncay Senturk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 5, 2024

Hi @Shevondalyn Robinson 

Where do you use this code? I don't know what script this is and if it supports ROUND function but I'd ensure parentheses are properly placed to group the calculations correctly

ROUND(([entry.date2.timestamp] - [now]) / 86400000, 2)

TAGS
AUG Leaders

Atlassian Community Events