" type="" "> " type="" " />
Easy Tutorial
❮ Jstl Sql Dateparam Tag Jstl Function Contains ❯

<fmt:parseDate> Tag

JSP Standard Tag Library

The <fmt:parseDate> tag is used to parse dates.

Syntax

&lt;fmt:parseDate
   value="<string>"
   type="<string>"
   dateStyle="<string>"
   timeStyle="<string>"
   pattern="<string>"
   timeZone="<string>"
   parseLocale="<string>"
   var="<string>"
   scope="<string>"/>

Attributes

The <fmt:parseDate> tag has the following attributes:

Attribute Description Required Default Value
value The date to be displayed Yes None
type DATE, TIME, or BOTH No date
dateStyle FULL, LONG, MEDIUM, SHORT, or DEFAULT No default
timeStyle FULL, LONG, MEDIUM, SHORT, or DEFAULT No default
pattern Custom format pattern No None
timeZone Time zone of the date to be displayed No Default time zone
var Variable name to store the formatted date No Display on the page
scope Scope of the variable to store the formatted date No Page

The attributes set the required output time format.


Example Demonstration

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<html>
<head>
  <title>JSTL fmt:parseDate Tag</title>
</head>
<body>
<h3>Date Parsing:</h3>
&lt;c:set var="now" value="20-10-2015" />

&lt;fmt:parseDate value="${now}" var="parsedEmpDate" 
                              pattern="dd-MM-yyyy" />
<p>Parsed date is: <c:out value="${parsedEmpDate}" /></p>

</body>
</html>

The above example results in:

Date Parsing:

Parsed date is: Tue Oct 20 00:00:00 CST 2015

JSP Standard Tag Library

❮ Jstl Sql Dateparam Tag Jstl Function Contains ❯