1

How to convert dd-mm-yyyy HH:mm:ss to yyyy-MM-dd HH:mm:ss using JSP?

Hari kanna
  • 2,461
  • 6
  • 29
  • 43

1 Answers1

5

You can use JSTL fmt - formatDate and parseDate tags:

http://download-llnw.oracle.com/javaee/5/jstl/1.1/docs/tlddocs/fmt/tld-summary.html

Example:

<fmt:parseDate var="parsedDate" value="${dateString}" pattern="dd-MM-yyyy HH:mm:ss"/>
<fmt:formatDate var="newFormattedDateString" value="${parsedDate}" pattern="yyyy-MM-dd HH:mm:ss "/>
Marimuthu Madasamy
  • 13,126
  • 4
  • 30
  • 52