Expand my Community achievements bar.

AEM query debugger date format issue

Avatar

Level 3

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?

3 Replies

Avatar

Level 10

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

Avatar

Level 3

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.

Avatar

Level 10

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.