Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How can I get todays date instead of second custom field (15317)?

Michael April 30, 2019

Hi,

Please see script below:

<!-- @@Formula:
if (issue.get("customfield_15320")==null || issue.get("customfield_15317") == null)
return null;
return (issue.get("customfield_15320").getTime() - issue.get("customfield_15317").getTime()) / 1000 / 3600 / 24; -->

 

I am looking to subtract today date from custom field 15320.

 

Thanks

1 answer

1 accepted

1 vote
Answer accepted
Elifcan Cakmak
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 30, 2019

Hello,

Are you using Misc custom fields add-on? If so, in the documentation it says you can get the current date as:

import org.joda.time.DateTime

DateTime date = new DateTime();

Here is the documentation:

https://innovalog.atlassian.net/wiki/spaces/JMCF/pages/141892419/Calculated+Scripted+Date+Time+custom+field+type

Regards. 

Michael April 30, 2019

Hi Elifcan,

Yes i'm using the custom fields add-on.  Do you know how I can subtract todays date from field 15320 into the custom number field?

Thanks

Elifcan Cakmak
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 30, 2019

Hello,

You can use it like this:

return(issue.get("customfield_15320").getTime() - (new Date()).getTime()) / 1000 / 3600 / 24

Regards.

Michael April 30, 2019

That works, thank you Elifcan!

Suggest an answer

Log in or Sign up to answer