This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Java in General and the fly likes Why is 01/01/2000 unparsable? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Why is 01/01/2000 unparsable?" Watch "Why is 01/01/2000 unparsable?" New topic
Author

Why is 01/01/2000 unparsable?

Timothy Sam
Ranch Hand

Joined: Sep 18, 2005
Posts: 746
I'm trying to use DateFormat object like this...



then I get...


java.text.ParseException: Unparseable date: "01/01/2000"


SCJP 1.5
http://devpinoy.org/blogs/lamia/ - http://everypesocounts.com/
Richard Green
Ranch Hand

Joined: Aug 25, 2005
Posts: 536
Try this


MCSD, SCJP, SCWCD, SCBCD, SCJD (in progress - URLybird 1.2.1)
Timothy Sam
Ranch Hand

Joined: Sep 18, 2005
Posts: 746
Would this solution be ok if I had to format a String like


2006-06-26 19:18:21.857


thanks for your answer!
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37926
    
  22
a String like


2006-06-26 19:18:21.857
Look in the API until you find SimpleDateFormat. It's all there.
Timothy Sam
Ranch Hand

Joined: Sep 18, 2005
Posts: 746
But I am having this error...

java.text.ParseException: Unparseable date: "2006-06-27 14:48:49.42"


Here's my method that parses a date String input



and here's how I use it...

Vishwas Hegde
Ranch Hand

Joined: Oct 02, 2003
Posts: 212

DateParser.parseDate("1980-02-14 00:00:00.0", "mm/dd/yyy")


Use this as the pattern yyyy-MM-dd HH:mm:ss.S

Later with this object (result), you can change it to your desired pattern.

Hope that helps.


~~Vishwas Hegde
SCJP 1.4,
SCJA
SCWCD 1.4
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Why is 01/01/2000 unparsable?
 
Similar Threads
how to convert date to a string
Time Zone Conversion of a String
Date 01/01/1970 returning non-zero value for time
Date Parsing Issue...
What class to use for date-related calculations.