This conversation has been locked due to inactivity. Please create a new post.
This conversation has been locked due to inactivity. Please create a new post.
Hi,
Iam using custom report in my tool.And I need help for modify or append the condition for below query.
In metadata property name (lastLoginDate) is string format like 2019-06-21T14:36:59.734Z.But in report result column i need to show only on yyyy-MM-dd format (2019-06-21). Kindly help to trim the value and iam not filter the value.
This is my Query:
SELECT * FROM [dam:Asset] AS s where ISDESCENDANTNODE([{{path}}])
{{#if assetType}} AND [jcr:content/metadata/assetType]="{{{assetType}}}" {{/if}}
{{#if assetCreatedDate}} AND [jcr:content/metadata/assetCreatedDate]="{{country}}" {{/if}}
ORDER BY [jcr:content/metadata/assetCreatedDate] ASC
Views
Replies
Total Likes
Hi,
Did you mean to convert from backend? or front end?
For Java you can use below:
/**
* @Param Calendar cal
* @Param String format
* @Return string Formatted date in specified format e.g. Jan 01 2019
*/
public static String getFormattedDate(Calendar cal, String format) {
String date = "";
if (cal != null && StringUtils.isNotBlank(format)) {
SimpleDateFormat formatter = new SimpleDateFormat(format, Locale.ENGLISH);
date = formatter.format(cal.getTime());
}
return date;
}
or
/**
* Converts AEM Date format "2011-11-10T10:20:59.400+01:00" to submitted format.
*
* @Param String dateStr
* @Param String format
* @Return string Formatted date ex: MMM DD YYYY format to Jan 01 2019
*/
public static String getFormattedDate(String dateStr, String format) {
if (StringUtils.isNotBlank(dateStr) && StringUtils.isNotBlank(format)) {
try {
SimpleDateFormat sdf = new SimpleDateFormat("MMM dd YYYY");
Date date = sdf.parse(dateStr);
SimpleDateFormat formatter = new SimpleDateFormat(format, Locale.ENGLISH);
return formatter.format(date);
} catch (ParseException | StringIndexOutOfBoundsException e) {
log.error("Not able to convert date, error : {}", e);
}
}
return "";
}
Views
Replies
Total Likes
Hi arun,
I am expected query level change only.need to add the condition in query section.
Views
Replies
Total Likes
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Like
Replies
Views
Likes
Replies