Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JSTL <fmt:parseDate>  RSS feed

 
Graeme Byers
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JSTL <fmt:parseDate>
====================
empBeanList is a List of JavaBean EmpBean : public Date getHireDate() { return hireDate ; }

${eb.hireDate} displays 1983-01-12
When I uncomment the <fmt:parseDate> line :
java.text.ParseException: Unparseable date: "1983-01-12"

What am I doing wrong ? I'm sure it must be an easy syntax problem.
Thank you for any help.

 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65824
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you already have a Date instance, why do you need parseDate at all? That's used to transform text into Date instances. You already have a Date instance so what's the point of the tag?
 
Graeme Byers
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear : To reformat the date from yyyy-MM-dd to dd-MM-yyyy using the pattern
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65824
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To reformat the date from yyyy-MM-dd

Dates have no format. Read that until you understand it. Dates are stored as a long value and have no format. None. So there's no format to have to convert from.

Therefore you do not need to parse the Date. It's already a Date! Just use <fmt:formatDate> to emit it in the format you want.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!