JSTL Format fmt:parseDate Tag

The <fmt: parseDate> tag is used to parse and format the date and time according to the customized formatting pattern.

Syntax Of <fmt: parseDate> Tag

<fmt: parseDate attributes/>

Attributes Of <fmt: parseDate> Tag

valueSpecifies date or time to be parsed.
typeSpecifies the string date, time or both to be parsed.
dateStyleSpecifies the style of date to be parse that is short, long or medium .
patternSpecifies the custom pattern that how the date or time to be parsed..
varSpecifies the variable name to which the parsed date and time has to be stored.
scopeThe Scope into which the variable date and time are defined in “var” attribute.
timeStyleSpecifies how the style of time has to be parsed that is short, long or medium.
timeZoneUsed to set the formatted date or time.
parseLocaleSpecifies the locale to parse the date or time.


<%@ page language="java" contentType="text/html; charset=UTF-8"
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<title>ParseDate Tag</title>
	<h2>Parse Date</h2>
	<c:set var="today" value="12-02-2014" />
	<fmt:parseDate value="${today}" pattern="dd-MM-yyyy" var="parseDate" />
	<c:out value="${parseDate}"></c:out>

Details of the Code

  • <fmt:parseDate value=”${today}” pattern=”dd-MM-yyyy” var=”parseDate”/>tag is used to parse the date by using the attribute value, pattern and var.
  • Pattern= “dd-MM-yyyy” is used to show how the date format to be displayed.

Steps for Execution

  • Save this file as example.jsp in your eclipse IDE.
  • Now select this jsp file, right mouse click and select Run as ->Run on server


When the execution process is completed successfully we will get the following output :
jstl_fmt parseDate tag output_demo


Previous Tutorial : JSTL Format fmt:formatDate Tag :: Next Tutorial : JSTL Format fmt:setLocale Tag

Leave a Reply

Your email address will not be published. Required fields are marked *

Pin It on Pinterest

Share This

Share this post with your friends!