Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

AEM query debugger date format issue

Avatar

Avatar
Ignite 1
Level 2
Riju-Mahna
Level 2

Likes

8 likes

Total Posts

31 posts

Correct Reply

0 solutions
Top badges earned
Ignite 1
Validate 10
Validate 1
Give Back 5
Give Back 3
View profile

Avatar
Ignite 1
Level 2
Riju-Mahna
Level 2

Likes

8 likes

Total Posts

31 posts

Correct Reply

0 solutions
Top badges earned
Ignite 1
Validate 10
Validate 1
Give Back 5
Give Back 3
View profile
Riju-Mahna
Level 2

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

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,408 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,408 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile
smacdonald2008
Level 10

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.

Avatar

Avatar
Ignite 1
Level 2
Riju-Mahna
Level 2

Likes

8 likes

Total Posts

31 posts

Correct Reply

0 solutions
Top badges earned
Ignite 1
Validate 10
Validate 1
Give Back 5
Give Back 3
View profile

Avatar
Ignite 1
Level 2
Riju-Mahna
Level 2

Likes

8 likes

Total Posts

31 posts

Correct Reply

0 solutions
Top badges earned
Ignite 1
Validate 10
Validate 1
Give Back 5
Give Back 3
View profile
Riju-Mahna
Level 2

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.

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,408 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,408 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile
smacdonald2008
Level 10

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.