Hi AEM Community,
I have done some findings that AEM only accepts long date format (YYYY-MM-DDT00:00:00.000-05:00) as "Date" Data Type for the node. Is there any configuration that can be done to store Simple Date Format (“YYYY/MM/DD”) as "Date" Data Type?
Is there an alternative other than storing the node field as String to store the Simple Date Format? The reason is I am using this Date for the Query Builder API and using it as String won't allow me to query as "daterange" or "relativedaterange" to do the query operations. Any suggestions and best practice to address this issue would really be appreciated.
Best Regards,
Anish
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
@BinaryAlchemy11 as a OOTB it is not possible but lets customize in sling model. Apart from that i dont see any option which i can think off. But it all dependends on the exact user case
@BinaryAlchemy11 By default, AEM does not provide an option to store a date in the format of "YYYY/MM/DD" as a "Date" data type. However, you can achieve this by writting a custom code to change the format
private Date date;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
try {
date = sdf.parse(dateString);
} catch (ParseException e) {
// handle the parse exception
}
Hi,
This would not work for my case as this would only be applicable if Date stored as String needs to be used for the logic.
The issue is as stated above, if I store the field as String data type then I will not be able to do the query builder operation of "daterange" for greater than or less than to filter out the assets.
0_group.1_group.daterange.property=jcr:lastModified
0_group.1_group.daterange.lowerBound=2015-04-18
0_group.1_group.daterange.lowerOperation=>=
@BinaryAlchemy11 as a OOTB it is not possible but lets customize in sling model. Apart from that i dont see any option which i can think off. But it all dependends on the exact user case