I'm trying to avoid reinstalling Eclipse to solve this, so I hope someone can help with this date-parsing problem. Here's what I do.
DateFormat dateFormat;
That's a variable in my class. I set it to the following.
dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
// Example input: 2010-11-07 16:00:00
When another method is called, I create a new java.sql.Date instance using strings that are passed in. For the sake of clarity, here's a shortened version.
public void aMethod (String activateTime, String expireTime) {
Date example = new Date(dateFormat.parse(activateTime).getTime());
Date example2 = new Date(dateFormat.parse(expireTime).getTime());
}
When I look at the strings resulting from these operations (just adding .toString() to instantiations above), I get output like the following
2010-10-30
2010-11-29
... instead of the input strings, which are reported to be...
2010-10-30 17:00:00
2010-11-29 16:00:00
Anyone know why it doesn't give me a date in the pattern I specified?