AEM query debugger date format issue | Community
Skip to main content
Riju-Mahna
Level 2
January 16, 2018

AEM query debugger date format issue

  • January 16, 2018
  • 1 reply
  • 4376 views

I am using AEM query builder to run some queries on my local instance

There is a custom property called 'publicationDate' in my website pages which is saved in a regular date time format in CRX . The format is verified across all pages in CRX. Example:

2017-02-23T00:00:00.000+05:30

But the json returned by the query above returns some results with a different format.

Most of the results are like: "2017-02-13T00:00:00.000+05:30" But some of them are returned as: "Fri Jan 12 2018 00:00:00 GMT-0500"

The sample json is:

{"success":true,"results":2,"total":56,"more":false,"offset":0,"hits":[{"jcr:content":{"metadata":{"publicationDate":["Fri Jan 12 2018 00:00:00 GMT-0500"]}}},{"jcr:content":{"metadata":{"publicationDate":["2017-06-28T00:00:00.000-04:00"]}}}]}

Is there any specific condition under which the results change their date format in the query results?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

smacdonald2008
Level 10
January 16, 2018

You can also use QUeryBuilder API to query the data and then use Java app logic to change the format of the data.

Riju-Mahna
Level 2
January 16, 2018

Yeah, but the query is being run by a third party application outside AEM using the url and then they are just parsing the json.

I wonder why different formats are returned.

smacdonald2008
Level 10
January 16, 2018

I am not aware of any setting that would explain the difference. There is no such discussion in the corresponding docs:

Query Builder API

However if this is a requirment - I would look at writing a Sling Servlet where a 3rd party system can make a GET request and the servlet would properly format the data and dynamically place it into JSON.