Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list

Date formatting in sightly


Level 3

Hi there,


Does anyone know how to format cq:lastModified  to RFC3339 format in Sightly?


Thanks in advance.



1 Accepted Solution


Correct answer by
Community Advisor
3 Replies


Correct answer by
Community Advisor


You can't do this in sightly, you need to do in java/sling model 


Community Advisor

Hi @hptarora ,


In Sling Model, something like below-


@Model(adaptables = Resource.class)
public class MyModel {

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);



Community Advisor



<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

The ultimate experience is back.

Join us in Vegas to build skills, learn from the world's top brands, and be inspired.

Register Now