String myDate = new String("2011-06-23T00:00:00");
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
this.thedate = format.parse(myDate);
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
I’m not sure what I’m doing, but I have a timestamp that will be a string and I want to parse out the year and month. This is what I have so far.
You need to use “yyyy-MM-dd’T’HH:mm:ss” as a pattern for the
SimpleDateFormat: