formatDate"
From Documentation
m |
|||
Line 10: | Line 10: | ||
Formats a Date into a date/time string with the given pattern. | Formats a Date into a date/time string with the given pattern. | ||
− | + | For example, | |
+ | <source lang="xml"> | ||
+ | <?taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c"?> | ||
+ | <zk> | ||
+ | <zscript> | ||
+ | java.util.Date date = new java.util.Date(); | ||
+ | </zscript> | ||
+ | <window title="ZUML" border="normal"> | ||
+ | <label value="${c:formatDate(date, 'MM/dd/yyyy')}" /> | ||
+ | </window> | ||
+ | </zk> | ||
+ | </source> | ||
There is another extended built in function, | There is another extended built in function, | ||
Revision as of 07:44, 2 May 2012
The default method:
String formatDate(Date date, String pattern);
Formats a Date into a date/time string with the given pattern. For example,
<?taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c"?>
<zk>
<zscript>
java.util.Date date = new java.util.Date();
</zscript>
<window title="ZUML" border="normal">
<label value="${c:formatDate(date, 'MM/dd/yyyy')}" />
</window>
</zk>
There is another extended built in function,
String formatDate(Date date, String pattern, Locale locale, TimeZone timezone, String dateStyle, String timeStyle);
Formats a Date into a date/time string with the given pattern, locale, timezone, date style and time style.
You can define a method to use this function by 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
Version | Date | Content |
---|---|---|
6.0.0 |