Hi there,
Does anyone know how to format cq:lastModified to RFC3339 format in Sightly?
Thanks in advance.
Harpreet
Solved! Go to Solution.
Views
Replies
Total Likes
Hi,
You can't do this in sightly, you need to do in java/sling model
Hi,
You can't do this in sightly, you need to do in java/sling model
Hi @hptarora ,
In Sling Model, something like below-
@Model(adaptables = Resource.class)
public class MyModel {
@Inject
private String myDate;
/**
* @return the myDate
*/
public String getMyDate() {
String lastModified = //Get the String
return new SimpleDateFormat("dd-M-yyyy hh:mm:ss").format(lastModified);
}
}
<sly data-sly-use.htl="com.aem.models.HTLSightlySlingModal"></sly>
<div>${'yyyy-MM-dd HH:mm' @format=htl.publishDate , timezone='UTC'}</div>
<div>${'EEEE, d MMM y' @format=htl.publishDate , timezone='UTC', locale='en'}</div>
where publishDate — returns Calender object
Views
Like
Replies
Views
Likes
Replies
Views
Likes
Replies