This blog is mainly about Java...

Wednesday, November 25, 2009


In the Seam documentation there is very little information about this tag.
In the documentation, there is only one example:
<h:outputText value="#{item.orderDate}">
   <s:convertDateTime type="both" dateStyle="full"/>

This doesn't really say much. However, after some googling, I can explain some of the attributes, and what is actually useful to use.
If you want to show both date and time: dd-MM-yyyy hh:mm:ss you can use type="both" and dateStyle="full". If you want to show only date. Use type="date".

You choose from a range of different dateStyle.
default                   May 14, 2007 2:35:45 PM ( Default Value)
short                     5/14/07 12:55:42 PM
medium                 May 14, 2007 2:42:36 PM
long                      May 14, 2007 2:41:08 PM
full                        Monday, May 14, 2007 2:39:56 PM

However what I have found the most useful is just to use the pattern attribute together with the type.
So if you want the style 14.07.2009 you just write

<h:outputText value="#{item.orderDate}">
   <s:convertDateTime type="both" pattern="dd-MM-yyyy"/>
And you are set to go! 

No comments: