new Date("05-MAY-09 03.55.50")
is any thing wrong with this ? i am getting illegalArgumentException
new Date("05-MAY-09 03.55.50")
is any thing wrong with this ? i am getting illegalArgumentException
Use colons to separate hours, minutes and seconds: "05-MAY-09 03:55:50"
That constructor is deprecated (since jdk 1.1).
It not even valid in java5
http://java.sun.com/j2se/1.5.0/docs/api/java/sql/Date.html
You should
SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
Date date = sdf.parse("05-MAY-09 03:55:50");
That Date constructor is deprecated for a reason.
You should be using a DateFormat / SimpleDateFormat instead to create Date instances from a String representation.
DateFormat df = new SimpleDateFormat("dd-MMM-yy hh.mm.ss");
Date myDate = df.parse("05-05-MAY-09 03.55.50");
This way, you can parse dates that are in just about any format you could conceivably want.
Other than the fact that you are using a deprecated method (you should be using SimpleDateFormat instead), this should work:
new Date("05-MAY-09 03:55:50");
Also check out Joda Time
Don't use this method, as it has been deprecated for years (and years). Use DateFormat.parse() in which you can easily define the format you want to parse.