• Post Reply Bookmark Topic Watch Topic
  • New Topic

Cannot Get Date to Format  RSS feed

 
Steve Dyke
Ranch Hand
Posts: 1779
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I am trying to use following code to format a date but get error.



Error:
java.text.ParseException: Unparseable date: "03/27/2012"
 
Henry Wong
author
Sheriff
Posts: 23289
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Steve Dyke wrote:

java.text.ParseException: Unparseable date: "03/27/2012"


Can you explain to us, how the date "03/27/2012" follows the format "dd/MMM/yyyy"?

Henry
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16045
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Steve Dyke wrote:I am trying to use following code to format a date but get error.

You are not trying to format a date; you are trying to parse a date.

Format = convert from a Date object to a string
Parse = convert from a string to a Date object
 
Campbell Ritchie
Marshal
Posts: 56209
171
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you storing the date in a database as a String? Why not use one of the SQL date types?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!