CodesJava

Easy learning with example program codes

JSTL fmt:parseDate Formatting Tag


The JSTL <fmt:parseDate> Formatting Tag is used for parsing the dates.

Syntax: <fmt:parseDate value=”val” otherattributes />

fmt:parseDate tag attributes:

Attribute Description Required
value Date value to read or parse. Yes
type DATE, TIME, or BOTH. No
dateStyle FULL, LONG, MEDIUM, SHORT, DEFAULT. No
timeStyle FULL, LONG, MEDIUM, SHORT, DEFAULT. No
parseLocale Locale to use when parsing the date. No
pattern It specify the custom parsing pattern. No
timeZone It specify the time zone of the parsed date. No
var It specify the name of the variable to store the parsed date. No
scope It specify the scope of the variable to store the formatted date. No

Example:

test.jsp

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
 
<html>
	<head>
		<title>fmt:parseDate JSTL formatting tag example</title>
	</head>
	<body>
		<c:set var="currentDate" value="2014-06-14" />
		<fmt:parseDate value="${currentDate}" 
                      var="parsedDate" pattern="yyyy-MM-dd" />
		Current date after parsing: <br/>	
		<c:out value="${parsedDate}"/>
	</body>
</html>

web.xml

<web-app>
 
  <welcome-file-list>
          <welcome-file>test.jsp</welcome-file>
  </welcome-file-list>	
 
</web-app>

Output:

jsp example 46
 
Download this example.
 
Next Topic: JSTL fmt:bundle Formatting Tag with example.
Previous Topic: JSTL fmt:formatDate Formatting Tag with example.

Related Topics:

JSTL fmt:formatNumber Formatting Tag with example.
JSTL fmt:parseNumber Formatting Tag with example.
JSTL fmt:formatDate Formatting Tag with example.
JSTL fmt:parseDate Formatting Tag with example.
JSTL fmt:bundle Formatting Tag with example.
JSTL fmt:setBundle Formatting Tag with example.
JSTL fmt:setLocale Formatting Tag with example.
JSTL fmt:timeZone Formatting Tag with example.
JSTL fmt:setTimeZone Formatting Tag with example.
JSTL fmt:requestEncoding Formatting Tag with example.

 

Sign Up/ Sign In
Ask a Question


Industrial Training

We offers Placement Oriented Training on Java, Spring, JSF, Hibernate, PHP, AngularJS, Angular 4, PLSQL, Oracle BI Publisher etc. We also provides Online training, please mail us at hr@codesjava.com.

Development

We also provides the Development services for Website Development , Java Development, PHP Development, Android App Development etc. You can contact us on hr@codesjava.com.

Copyright © 2018 CodesJava DMCA.com Protection Status SiteMap Reference: Java Wiki