[opencms-dev] How to format date with cms:contentshow

Thierry Collogne tcollogne at hotmail.com
Mon Jan 9 10:48:28 CET 2006


Hi all,

I have a custom xml content and I am using the following code to display the 
content


<body>
      <cms:editable/>

      <div class="element">
         <cms:contentload collector="allInFolderDateReleasedDesc" 
param="/playground/events/news_${number}.html|wdog_article" editable="true">
            <h2><cms:contentshow element="Title" /></h2>
            <p><cms:contentshow element="Date"/></p>
            <cms:contentcheck ifexists="Image">
                <img src="<cms:link><cms:contentshow 
element="Image"/></cms:link>">
            </cms:contentcheck>
            <p><cms:contentshow element="Text"/></p>
         </cms:contentload>
      </div>

</body>


The problem is that the "Date" element is displayed as a long, not as a 
formatted date. Does anyone know how I can format this.

I know that in the java api there is a CmsDateUtil class which can be used 
for formatting, but I don't know how I can get the value of "Date" element 
for using the getDateTimeShort(long time) method.

I have tried the following, but that doesn't work

<%
               out.print(CmsDateUtil.getDateTimeShort(<cms:contentshow 
element="Date"/>));
%>



Anyone?





More information about the opencms-dev mailing list