Forums

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

Calculated Text Field - to format a date

werner kolze May 20, 2018

Hi everybody -

I have the below code applied to a Calculated Text field - it checks for contents of two separate fields which should contain a date - if one of them does, then it should reformat that date and display it in the requested format - but it does not - the logfile contains the error:

CalculatedTextField: error evaluating formula of field "<fieldname>" of issue GGG-123: Parse error at line 21, column 5.  Encountered

Please find below the code - what is the problem? what is the remedy? I searched for a while but to no avail  -  can someone please help?

thanks a lot

 

import java.text.SimpleDateFormat;

String s = issueObject.issueTypeObject.name;

if (s.equals("ABC"))
{
 
  engineeringDate = issue.get("customfield_15267");

  if (engineeringDate == null)
  {
    if (engineeringDate = issue.get("customfield_16735") != null)
    {
        String dateString = new SimpleDateFormat("dd-MM-yyyy hh:mm a").format(engineeringDate);
        return dateString;
    }else
    {
      return ""
    }
  }
   else
  {
    String dateString = new SimpleDateFormat("dd-MM-yyyy hh:mm a").format(engineeringDate);
    return dateString;
  }

} else if (s.equals("XYZ"))
{
   engineeringDate = issue.get("customfield_15267");

   if (engineeringDate != null)
   {
      String dateString = new SimpleDateFormat("dd-MM-yyyy hh:mm a").format(engineeringDate);
      return dateString;
   }else
   {
    return ""
   }   
}

 

0 answers

Suggest an answer

Log in or Sign up to answer