MISC Custom Fields: Calculate person's age

Hi! i'm using JIRA 6.3.9


I have date of birth, and i need JIRA to count his age.

I tryed this formula:

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

It works close, but not perfect. If i put date of birth 20 december 1974 - it will count 40 years (instead of 39)

1 answer

1 accepted

0 votes
Accepted answer

That's because the value is rounded up to the nearest integer. If you want to truncate the value instead, use Math.floor( ):

&lt;!-- @@Formula: issue.get("created")==null ? null : Math.floor(((new Date().getTime()) - issue.get("customfield_xxxxx").getTime()) / 1000.0 / 31536000) --&gt;

still 40 years. I think thats because it don't count 29 february every 4 years

Yes, you should divide by 31557600 (365,25 days per year).

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 27, 2018 in Portfolio for Jira

Introducing a new planning experience in Portfolio for Jira (Server/DC)

In the past, Portfolio for Jira required a high degree of detail–foresight that was unrealistic for many businesses to   have–in   order to produce a reliable long-term roadmap. We're tur...

2,975 views 19 22
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you