Saturday, 31 August 2013

Java: String to Date

Java: String to Date

I have spent lot of time to convert my string to date. I have string in
Fri Jan 04 12:32:28 CST 2013
format. And my code is below
myDate=(Date) new SimpleDateFormat("EEE MMM dd kk:mm:ss zzz
yyyy").parse(str);
Please help me how to get rid of this. This code throws exception
java.lang.ClassCastException: java.util.Date cannot be cast to java.sql.Date

No comments:

Post a Comment