Highlighted

AEM query debugger date format issue

Avatar

Avatar

Riju_Mahana

Avatar

Riju_Mahana

Riju_Mahana

16-01-2018

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?

Replies

Highlighted

Avatar

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K
smacdonald2008

16-01-2018

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

Highlighted

Avatar

Avatar

Riju_Mahana

Avatar

Riju_Mahana

Riju_Mahana

16-01-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.

Highlighted

Avatar

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K
smacdonald2008

16-01-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.