I'm getting the error
java.lang.ClassCastException: java.util.Date
at avb.Test.main(Test.java:38)
SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS")
from the code
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
String tmp = "2012-03-16 18:58:14.0";
Date MaxCmTimerUpdate = (Date)df.parse(tmp);
What am I doing wrong? How do I fix it?
(Date) df.parse(tmp)? Besides,DateFormat.parse(String)already returns a java.util.Date, so there's no need for the casting.