Field with time difference between "Created" and a Timestamp.

Hello everybody


I have gone around the answers forum a lot trying to understand how to achieve this.

Basically: I have one field in my issue with a timestamp, which is added with a Post Function  using of course


The I created a second field, a calculated number field, where I want to calculate the time difference between this time stamp and the created date.

My first idea was to go with 

<!-- @@Formula: issue.get("customfield_27438")==null ? null : ((Double)(issue.get("customfield_27438").getTime() - issue.get("created").getTime())) / 1000 / 3600 / 24 -->

But this is not working because the timestamp is in facts a text field, so i cannot use the getTime() method with it.

I tried to use the getValue() then, but also this is not working.

What could be the solution to make the two values (the text field with the timestamp and the "created" date) so that I can have the field calculate correctly?

Thanks in advance for any help!













2 answers

1 accepted

0 vote

Why didn't you use a date/time field for the timestamp?

You'd then have two date/time fields that you can take as "milliseconds since base date", subtract one from the other and then divide the result to get it in seconds/minutes/hours etc

Hey Nic! 

Thanks a lot. I had the impression that the post-function could not update the time picker with %%CURRENT_DATETIME%%

But I tried again now and it works. I might have missed something when I tried the first time.

Great, so now it works! I'll go to the next challenge now (excluding the weekends :) )

Thanks a lot for your time!

Have an awesome weekend




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
Posted Wednesday in Jira

Join our webinar: How 1B+ feature flag events helped us build the new Jira

Every time you release software, there's a bit of risk – that there's a bug, that something breaks, or that the feature doesn't resonate with customers. Feature flagging helps make high stakes s...

103 views 0 2
Join discussion

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