The dateformat tag either formats a datetime for output or parses one from an input. The format attribute specifies the format to use either to format for output or to parse from input. If the parse attribute is specified then that value is used as the parse string to set the specified datetime. If the parse attribute is not specified then the datetime is formatted to the page output.
JSP
The datetime to operate on is located as follows. If the name attribute is specified then that datetime bean is used. Otherwise the parent datetime tag is used.
The tag has the following attributes for which the Required values are “Yes” and “No”:
Specifies the name of the datetime bean to use. If not specified then the parent datetime tag is used.
The java.text.SimpleDateFormat format string to use to format or parse the datetime with.
The string to parse into a datetime using format.
n/a
<%-- create now datetime and output hours/minutes --%> <cal:datetime id="now"/> <cal:dateformat name="now" format="hh:mm"/> <%-- set datetime from hours/minutes parse string --%> <cal:datetime> <cal:dateformat format="hh:mm" parse="10:30"/> </cal:datetime>