1

I'm using the following conversion from string to date

    String attr = "2013-09-11"
Date date = null;
SimpleDateFormat parsedDate = null;

parsedDate = new SimpleDateFormat("yyyy-mm-dd");

try {
date = parsedDate.parse(attr);
} catch (ParseException e) {

}

Now the date have value Fri Jan 11 00:09:00 IST 2013 why is that? and how can I change it to bring appropriate value?

Jean Tennie
  • 253
  • 1
  • 5
  • 17

1 Answers1

2

mm is for minutes, you're looking for MM for months.

parsedDate = new SimpleDateFormat("yyyy-MM-dd");

More info: SimpleDateFormat, in the Date and Time Patterns and Examples section .

Luiggi Mendoza
  • 85,076
  • 16
  • 154
  • 332