It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

get simple month year from custom date field Edited

I want to capture just the month and year from a date picker field.  For example, I click on the field, in a date picker choose, 2/20/2019, and the field then stores Feb 2019.


As an alternative, I could leave that field as a date picker, then do a separate calculated field to get the MMM YYYY format.

I got this far...

import java.text.SimpleDateFormat
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.fields.CustomField

def cf = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Target Delivery Date")
def tcDate = issue.getCustomFieldValue(cf)

return new SimpleDateFormat("MMMM, yyyy", Locale.US).format(new Date(tcDate));


But get an error

groovy.lang.GroovyRuntimeException: Could not find matching constructor for: java.util.Date(java.sql.Timestamp)


Thanks for any help.

0 answers

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Marketplace Apps & Integrations

Marketplace Spotlight: November Continuous Integrations

                                                Shipping new code shoul...

67 views 0 1
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you