Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.

Unix timestamp convert to Gregorian

Avatar

Level 1

Hi,

I have created Site Page to display Form ID (in CRX - formID) and to display last modify date from metadata (in CRX jcr:LastModified). These are out of the box metadata information. The page is able to display but the display data does showed up on Unix timestamp (eg. 1571836800000) and not Gregorian (eg. 10-23-2019 08:20). The properties that I am editing are in template.html property through CRXDE Lite( apps/fd/fp/<folder>/template.html ). Is there a way to display information in Gregorian format? Thanks.

Below is an example of template.html.

<table class="m-tab __FP_grid-table __FP_single-color" width="100%" style="table-layout:fixed;" cellpadding="0" cellspacing="0" border="0">
    <thead>
        <tr>
            <th class="__FP_grid_overflow-control-th __FP_grid-name __FP_grid_sort" tabindex="0" data-sortKey="formid">Form ID</th>
            <th class="__FP_grid_overflow-control-th __FP_grid-description __FP_grid_sort" tabindex="0" data-sortKey="jcr:lastModified">${localize-jcr:lastModified}</th>
            <th class="__FP_grid_overflow-control-th __FP_grid-description" tabindex="0">${localize-Actions}</th>
        </tr>
    </thead>
    <tr data-repeatable="true">
        <td class="__FP_grid_overflow-control" title="${formid}" tabindex="0" data-label="${localize-Form ID}">${formid}</td>
<td class="__FP_grid_overflow-control" title="${description}" tabindex="0" data-label="${localize-jcr:lastModified}">${lastModified}</td>

        <td class="__FP_grid_open-download-image" data-label="${localize-Actions}">
            <a style="cursor:pointer;" onclick="javascript:window.open('${formUrl}', '_blank');" class="__FP_panel-html-open ${htmlStyle}" title="${config-htmlLinkText}"></a>
            <a href="https://forums.adobe.com/lc/bin/acsforms/render/renderextend?xdppath=${path}" target="_blank" class="__FP_panel-pdf-open ${pdfStyle}" title="${config-pdfLinkText}"></a>
        </td>
    </tr>
</table>

2 Replies

Avatar

Employee

Is your question similar to HTL AEM 6.3 DateFormat ? Then the answer may be using the format option like this: ${'dd-MM-yyyy' @ format=lastModified}

I tested :

'dd-MM-yyyy' @ format=properties.jcr:created is ${'dd-MM-yyyy' @ format=properties.jcr:created}

which renders as:

'dd-MM-yyyy' @ format=properties.jcr:created is 14-11-2018

Avatar

Level 1

Close enough. Did some experiment and seem to get what I needed. Thank you.