We give all our news items/pages a date field through the Page Properties dialog. This xtype is datefield. So I can configure it to be MM-DD-YYYY or DD-MM-YYYY, etc. My question is how can I use the JCR SQL query language to order my query by this date field. I'm using
ORDER BY datePosted DESC
Currently the date is stored as MM-DD-YYYY. It reads only the month value and orders it by that. How cna I make it read the whole date value?
Solved! Go to Solution.
I was able to change the format of the DatePicker to YYYY-MM-DD and my original query worked to sort!
Views
Replies
Total Likes
This is the Syntax using JCR SQL2:
SELECT p.* FROM [nt:base] AS p WHERE ISDESCENDANTNODE('/') AND (p.[date] <> '' AND p.[date] > CAST('2015-11-30T00:00:01.000Z' AS DATE)) order by p.[date] asc
Source:
https://wiki.magnolia-cms.com/display/WIKI/JCR+Query+Cheat+Sheet
Hope this helps...
I was able to change the format of the DatePicker to YYYY-MM-DD and my original query worked to sort!
Views
Replies
Total Likes
Thxs for posting upur solution!
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies