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

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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Sunday in Agility

You asked for it, so we delivered: images on issues have arrived

A picture tells a thousand words. And agility boards have just released their latest feature: cover images on issues – so now your board can tell a story at first glance. Upload attachmen...

189 views 1 11
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