コミュニティアチーブメントバーを展開する。

Submissions are now open for the 2026 Adobe Experience Maker Awards.

Mark Solution

この会話は、活動がないためロックされています。新しい投稿を作成してください。

解決済み

HTL AEM 6.3 DateFormat

Avatar

Level 4

AEM 6.3 Date format, i have created the below HTL

<h2>${ 'MM/dd/yyyy HH:mma' @ format=pageProperties.cq:lastReplicated}</h2>

its provide the output as "<h2>03/07/2018 20:08PM</h2>"

I have requirement to change the PM as pm, likewise AM as am (Lowercase). Is that acheivable using HTL?

1 受け入れられたソリューション

Avatar

正解者
Level 5

HI michaelvino86

You can use

  1. <h2>${ 'dd-MM-yyyy' @ format=currentPage.jcr:created}</h2>

  1. <h2>${ 'dd-MMM-yyyy hh:mm:ss' @ format=currentPage.jcr:created, timezone='PST'}</h2>

  1. <h2>${ 'dd-MMMM-yyyy hh:mm:ss' @ format=currentPage.jcr:created, timezone='PST', locale='fr'}</h2>

To directly formet the date after AEM6.2.

元の投稿で解決策を見る

8 返信

Avatar

Level 10

You can parse the string and change the case using custom logic.

Avatar

Level 4

Do you want me to use java or javascript to parse the string? i was thinking like, for a small change is that required to create a use-API.

I am looking for a solution from HTL itself. Correct me if i am wrong.

Avatar

Level 10

This is standard JS functionality -- JavaScript String toLowerCase() Method

Avatar

Level 10

To learn how to use JS API for HTL -- see this HELPX Article -- Creating a Tab layout component for Adobe Experience Manager

The use case here is a tab-based HTL component - but it shows use of the JS API for HTL. We have articles too for WCMUSePojo and Sling Models.

Avatar

Level 10

Yes, Scott is right.

You can simply parse using Java Script as given in link: JavaScript String toLowerCase() Method

Avatar

Level 4

Could you please provide the code snippet.

Avatar

Level 10

See the links provided in this thread to see how to use JS to lower case a string.

Avatar

正解者
Level 5

HI michaelvino86

You can use

  1. <h2>${ 'dd-MM-yyyy' @ format=currentPage.jcr:created}</h2>

  1. <h2>${ 'dd-MMM-yyyy hh:mm:ss' @ format=currentPage.jcr:created, timezone='PST'}</h2>

  1. <h2>${ 'dd-MMMM-yyyy hh:mm:ss' @ format=currentPage.jcr:created, timezone='PST', locale='fr'}</h2>

To directly formet the date after AEM6.2.