Set a Calculated Date base on custom field date value

 

we have one calculated datetime field based on another custom date field and the formula in below worked.

<!-- @@Formula:(issue.get("customfield_10805") == null ? null : issue.get("customfield_10805")) -->

<!-- @@ format: DATE  -->

However, the format is still datetime format (dd/MMM/YY hh:mm)

is there any way to make it display date only ?

 

If I add calculation function into it, it became invisible (doesn't work)

<!-- @@Formula:(issue.get("customfield_10805") == null ? null : issue.get("customfield_10805")-21) -->

<!-- @@ format: DATE  -->

can any suggest how I calculated the date based on another custom field ( A-21) ?

 

Thank you,

 

1 answer

0 vote

Hi Sonya,

regarding the date formatting, the marker is “@@Format:”, not “@@ format:”. So try:

<!-- @@Format: DATE -->

As for calculations on Date objects, you can’t use operators. You need to get the number of milliseconds of the date, add or substract the duration in milliseconds, and then create a new date from it:

new Date(issue.get(“customfield_10805”).getTime() - 21*24*60*60*1000)

Hi David, 

thank you, however, it still doesn't work in my end. 

 

I've tried to use below setting, neither of them work >"<

<!-- @@Formula: (issue.get(“customfield_10805”).getTime() +5184000000) -->

<!-- @@Formula: 
new Date(issue.get(“customfield_10805”).getTime() - 21*24*60*60*1000)
-->

<!-- @@Formula: 
new Date(issue.get(“customfield_10805”).getTime() - 21*24*60*60)
-->

 

the only work in my end is , but still display in date time format

<!-- @@Formula:issue.get("customfield_10805") -->

<!-- @@ Format: DATE_PICKER -->

Hi Sonya,

regarding the formula, only the second one should work. Did you find any error in the Jira logfile (atlassian-jira.log)?

And regarding the format, there should be no space between @@ and Format - c.f. my example.

Regards,

David

hi, David, 

for formula 2, it doesn't work. (for no reason >"<)

 

for format, it works after remove space, thank you :)

As I said, did you look for errors in the log file?

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Bridget Sauer
Published yesterday in Marketplace Apps

Calling all developers––You're invited to Atlas Camp 2018

 Atlas Camp   is our developer event which will take place in Barcelona, Spain  from the 6th -7th of   September . This is a great opportunity to meet other developers and get n...

72 views 0 5
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