- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to parse date in JSP?
The <fmt:parseDate> tag is used to parse dates.
Attribute
The <fmt:parseDate> tag has the following attributes −
Attribute | Description | Required | Default |
---|---|---|---|
Value | Date value to read (parse) | No | Body |
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 |
parseLocale | Locale to use when parsing the date | No | Default locale |
pattern | Custom parsing pattern | No | None |
timeZone | Time zone of the parsed date | No | Default time zone |
var | Name of the variable to store the parsed date | No | Print to page |
scope | Scope of the variable to store the formatted date | No | page |
A pattern attribute is provided that works just like the pattern attribute for the <fmt:formatDate> tag. However, in the case of parsing, the pattern attribute tells the parser what format to expect.
Example
<%@ 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> <c:set var = "now" value = "20-10-2010" /> <fmt:parseDate value = "${now}" var = "parsedEmpDate" pattern = "dd-MM-yyyy" /> <p>Parsed Date: <c:out value = "${parsedEmpDate}" /></p> </body> </html>
The above code will generate the following result −
Date Parsing: Parsed Date: Wed Oct 20 00:00:00 GST 2010
- Related Articles
- How to parse number in JSP?
- How to parse percentages in JSP?
- How to parse currencies in JSP?
- How to parse an XML in JSP?
- How to parse date sting to date in Java?
- How to parse date in MySQL?
- How to format date in JSP?
- How to parse Date strings in Golang?
- How to print a date using JSP Expression?
- Is there any JSTL library to parse XML in a JSP?
- Format and Parse Date in Java
- Java Program to parse date and time
- How to print current date and time in a JSP page?
- How to print date and time in specific format using JSP?
- Parse string date value input in Java

Advertisements