Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Parse a date  RSS feed

 
Isaac Ferguson
Ranch Hand
Posts: 1063
3
Java Netbeans IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am trying to parse a date, I get this error:



When my code for parsing is:





When from is "04/01/1983" and dateFrom is Date ( java.sql.Date;)

Any idea?

Regards,
Isaac
 
Arun Kumarr
Ranch Hand
Posts: 662
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The exception says it correct.
your date string ('04/01/1983') is of format - "dd/MM/yyyy" instead of the specified "dd-MM-yyyy".
 
Roel De Nijs
Sheriff
Posts: 11338
177
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you should adjust your date pattern to dd/MM/yyyy or MM/dd/yyyy in order to successfully parse your date.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!