-1

I'm trying to print a day of the given date. How can I do that?

String date = "2015.05.12";
SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd");
Date bornDate =  format.parse(date);
System.out.println(bornDate.getDay());//this prints "2" instead of "12"
xenteros
  • 15,028
  • 12
  • 52
  • 85

1 Answers1

1

You can use bornDate.getDate() to get day. You shall use calendar class as methods on date are deprecated.

Sanjeev
  • 9,798
  • 2
  • 20
  • 33