1

I have a string field that is shown as a date in YYYY-MM-DD format. I am trying to convert this field on my JSP to MM/DD date format. Here is the JSTL code I have now:

        <fmt:parseDate var="taxFromDate" value="${a8spt214.fromDate}" pattern="MM-dd"/>   
        <fmt:parseDate var="taxToDate" value="${a8spt214.toDate}" pattern="MM-dd"/>   

When I try running this I get a compile error saying the following

 In &lt;parseDate&gt;, value attribute can not be parsed: "2017-06-30"] with root cause java.text.ParseException: Unparseable date: "2017-06-30"

is it possible to convert a string to a date filed in JSP without actually using the year in the format? Or is the pattern invalid?

Thanks

hammerva
  • 129
  • 1
  • 14

1 Answers1

0

You can use this Code to show this type of date MM/DD/YY

<p>Formatted Date : <fmt:formatDate type = "both" 
         dateStyle = "short" timeStyle = "short" value = "${now}" /></p>

The Code above will Print this result:

Formatted Date : 23/09/10 14:27

I hope to help you solve problem.

Feras Al Sous
  • 1,073
  • 1
  • 12
  • 23