But I am able to retrieve the other custom and OOTB jcr properties like ${pageProperties.jcr:title}
Is there a different mechanism to fetch the 'cq:' properties ?
/Regards
Kanwal
Solved! Go to Solution.
Views
Replies
Total Likes
Have a look at this article: http://blogs.adobe.com/experiencedelivers/experience-management/date-formatting-sightly/
Views
Replies
Total Likes
to this is likely because it is a date-field.
can you try ${properties.cq:lastReplicated.toString}
Views
Replies
Total Likes
Hi Feike,
doing ${properties.cq:lastreplicated.toString} prints the GregorianCalendar object as string.
java.util.GregorianCalendar[time=1438916511961,areFieldsSet=true,areAllFieldsSet=true,lenient=false,zone=sun.util.calendar.ZoneInfo[id="GMT+10:00
I was looking to get the date string only. Tried ${properties.cq:lastreplicated.getString} and ${properties.cq:lastreplicated.string} but both didn't work.
Thanks,
Deepak
Views
Replies
Total Likes
Have a look at this article: http://blogs.adobe.com/experiencedelivers/experience-management/date-formatting-sightly/
Views
Replies
Total Likes
@Deepak,
This code may help you.
package com.mycompany.aem.slighty;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import com.adobe.cq.sightly.WCMUse;
public class Info extends WCMUse {
public String finalDate;
String tempDate;
String[] dateTemp;
Map<String,String> tempMap=new HashMap<String, String>();
@Override
public void activate() throws Exception {
tempDate=getProperties().get("jcr:created").toString();
dateTemp=tempDate.split(",");
for(int i=0;i< dateTemp.length;i++){
String[] temp=dateTemp[i].split("=");
tempMap.put(temp[0], temp[1]);
}
finalDate=tempMap.get("DAY_OF_MONTH")+":"+tempMap.get("MONTH")+":"+tempMap.get("YEAR");
}
public String getFinalDate(){
return finalDate;
}
}
You can put this java file along with your component html and can call to this info class as below.
<div data-sly-use.info="Info">
<h3>original value is : ${properties.jcr:created.toString}</h3>
</br>
<h4>final value is : ${info.finalDate}</h4>
</div>
Thanks,
Shivamurthy MN
Views
Replies
Total Likes
Hi,
This doesn't work either.
<sly data-sly-use.util="${'util.js' @ date=currentPage.lastModified.time, mask='dd MMMM yyyy'}"> --- this works. But I couldn't get something similar for cq:lastReplicated value.
Could you please direct me to some article which specifies the list of properties allowed with 'currentPage' convenience object?
Regards,
Bhavya S
Views
Replies
Total Likes
Hi,
Last Replicated at ${'MM/dd/yyyy HH:mma' @ format=pageProperties.cq:lastReplicated } will work
and to get the details of all HTL global object and their API's you can check below:
Thanks
Arun
Hi,
I need date format as "August 17, 2022". Is it possible?
Also, the link http://blogs.adobe.com/experiencedelivers/experience-management/date-formatting-sightly/ is not working.
Regards,
Priyanshi
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies