This example shows how to format and display Date in JSP. Below Java JSP code formats java.util.Date object with given pattern using JSP Standard Tag Library (JSTL).
1 2 3 4 5 6 7 8 9 10 11 |
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> <html> <head> </head> <body> <jsp:useBean id="date" class="java.util.Date"/> Today is: <fmt:formatDate value="${date}" type="date" pattern="dd-MMM-yyyy"/> </body> </html> |