Custom JSP tag. Tag DateTime prints formatted date/time value. Without id parameter tag prints calculated value, with this parameter tag prints nothing but creates a variable (page scope, type is String) initialized by the calculated value.
For example:
<%@ taglib uri="taglib.tld" prefix="dt" %>
<html>
...
Time stamp: <dt:DateTime format="dd/MMM/yyyy hh:mm" />
Initialize page scope variable: <dt:DateTime format="dd/MMM/yyyy hh:mm" id="A" />
Result is: <%=A%>
With user's locale for GMT offset -2:
<dt:DateTime format="EEE dd" locale="<%=request.getLocale()%>" offset="-2" />
Formats some calculated value:
<dt:DateTime format="dd/MMM/yyyy" value="<%=mybean.getTime()%>" />
...
</html>
Tags are:
DateTime
Formats date/time. Parameters are:
1) id Optional parameter. Describes page scope variable
2) format Optional parameter. Describes pattern for format.
By default tag will use server's time in milliseconds.
3) value Optional parameter. Describes some value (java.util.Date).
By default tag will use current server's time
4) offset Optional parameter. Describes system time adjustment to the given GMT offset
(some integer value, positive or negative)
5) locale Optional parameter. Describes any valid locale. E.g.: request.getLocale().
for downloading:
Library: datetime.jar Description: taglib.tld
See also Coldtags suite - the largest collection of custom JSP tags.