tags:

views:

26

answers:

1

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

+2  A: 

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