• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

JSTL <fmt:parseDate>

 
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
Sheriff
Posts: 67595
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Bear : To reformat the date from yyyy-MM-dd to dd-MM-yyyy using the pattern
 
Bear Bibeault
Sheriff
Posts: 67595
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic