From Documentation

The default method:

String formatDate(Date date, String pattern);
i.e., CommonFns.formatDate(Date, String)

Formats a Date into a date/time string with the given pattern. For example,

<?taglib uri="" prefix="c"?>
		java.util.Date date = new java.util.Date();
	<label value="${c:formatDate(date, 'MM/dd/yyyy')}" />

There is another extended built-in function: CommonFns.formatDate(Date, String, Locale, TimeZone, String, String), not declared in taglib.

Formats a Date into a date/time string with the given pattern, locale, timezone, date style, and time style.

You can call it by EL or declaring a xel-method.

Note: If the date style/time style is applied, the pattern will be ignored.

Parameters: In both default and extended function:

  • date - the Date to format
  • pattern - the pattern to apply

In extended function only:

  • locale - the locale to apply
  • timezone - the timezone to apply
  • dateStyle - the date style to apply
  • timeStyle - the time style to apply

Version History

Last Update : 2021/05/27

Version Date Content

Last Update : 2021/05/27

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.