Hello, I am using the below script for displaying the Release Date from the Fix version under the issue page. Currently, the field displays the DATE & TIME. I want to make sure ONLY the DATE gets displayed without the time.
import java.sql.Timestamp
import java.text.DateFormat
import java.util.Date
Collection versions = issue.getFixVersions()
if (versions==null || versions.size()!=1)
return null
def version = versions.iterator().next()
new Date(version.releaseDate.time)
Can someone help me with how to remove the TIME from getting displayed ? Thank you
Hello,
It should be like this:
import java.text.SimpleDateFormat
import java.sql.Timestamp
import java.text.DateFormat
import java.util.Date
Collection versions = issue.getFixVersions()
if (versions==null || versions.size()!=1)
return null
def version = versions.iterator().next()
SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("dd-MM-yyyy");
DATE_FORMAT.format(new Date(version.releaseDate.time);
@Alexey Matveev Hi Alexey. Thank you for the response.
For the last line, getting the error pop up as 'unexpected token' and the script returns no value
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
import java.text.SimpleDateFormat
import java.sql.Timestamp
import java.text.DateFormat
import java.util.Date
Collection versions = issue.getFixVersions()
if (versions==null || versions.size()!=1)
return null
def version = versions.iterator().next()
SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("dd-MM-yyyy");
return DATE_FORMAT.format(new Date(version.releaseDate.time));
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Getting this error,
Script Fields java.lang.Exception: The search indexer: class com.atlassian.jira.issue.customfields.searchers.DateTimeRangeSearcher expected your script to return a java.util.Date, but it returned an java.lang.String. We couldn't convert it to a java.util.Date
How to fix this ? Please help
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The problem is that your searcher is com.atlassian.jira.issue.customfields.searchers.DateTimeRangeSearcher. You can change it to the free text.
Also have a look at this thread
https://community.atlassian.com/t5/Adaptavist-questions/Date-format-for-script-field/qaq-p/698130
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The thread you shared was perfect ! Fixed it using the Custom template. Thank you so much.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You are welcome!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.