This lets you format dates (including calendar-objects), numbers (Integers, Long, Double, Float) into different formats based on a pattern and locale.


The result variable name.

Name Required Default Type Description
id false   String .
type false   Object/String If you set “fileSize” and supply a number a special formatting will kick in.
value true   Object/String The value to format.
pattern false Different Object/String The pattern to use when formatting.
For dates it’s SimpleDateFormat patterns you use and for Numbers you
use DecimalFormat-pattens.
locale false   Object/String The locale to use when formatting.



This example formats a news date to ISO-format.

<content:matchingContents id="articles"
<c:forEach var="article" items="${articles}" varStatus="count">
<content:contentAttribute id="Title" contentId="${article.contentId}"
<c:out value="${Title}"/> - <common:formatter
value="${article.publishDateTime}" pattern="yyyy-MM-dd"><br/>

Look at patterns for dates here:
Look at patterns for numbers here:

comments powered by Disqus