You can get week number using this method.
public int getDayOfWeek(Date date) {
Calendar c = Calendar.getInstance();
c.setTime(date);
return c.get(Calendar.DAY_OF_WEEK);
}
you have to pass formatted date to this method and it returns week number.
EDIT1:
SimpleDateFormat format = new SimpleDateFormat("EEEE", Locale.getDefault());;
Date date;
Calendar calendar = Calendar.getInstance();
try {
date = format.parse(format.format(calendar.getTime()));
int weekDay = getDayOfWeek(date);
} catch (ParseException e) {
e.printStackTrace();
}
EDIT2:
String dtStart = "2010-10-15";
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
try {
Date date = format.parse(dtStart);
//this date can be passed to getDayOfWeek method
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
I hope it helps!