This solution works for any language (the first day of the week can be Sunday or Monday).
Date date = new Date(); Calendar c = Calendar.getInstance(); c.setTime(date); int dayOfWeek = c.get(Calendar.DAY_OF_WEEK) - c.getFirstDayOfWeek(); c.add(Calendar.DAY_OF_MONTH, -dayOfWeek); Date weekStart = c.getTime(); // we do not need the same day a week after, that why use 6, not 7 c.add(Calendar.DAY_OF_MONTH, 6); Date weekEnd = c.getTime();
For example, today is January 29, 2014. For a region with Sunday on the first day of the week, you will receive:
start: 2014-01-26 end: 2014-02-01
For a locale with Monday on the first day, the following dates will be indicated:
start: 2014-01-27 end: 2014-02-02
Akima
source share