Page tree
Skip to end of metadata
Go to start of metadata

The DateFormat  field expression is used to format a date value for viewing by the end user.  For instance, in the following examples a date field value of "2013-09-09T17:35:54" was rearranged to be "09/09/2013." 

Example:

QueryRequest request = new QueryRequest("*:*)");
request.addField(new DateFormat("date","MM/dd/yyyy","New Date"));
// ... (Perform Search)

REST Syntax:

DATEFORMAT(FIELDEXPRESSION,FORMAT) AS ALIAS

  • FIELDEXPRESSION - the field that contains the date you want to reformat.
  • DATEFORMAT - Date format string. 
  • ALIAS - Optional new field name for the transformed date value.

Example:

&fields=dateformat("date","MM/dd/yyyy")
&fields=dateformat("date","MM/dd/yyyy") as "New Date"
  • No labels