How to get first day of week, when we know one of the date in the week?
I know the current month , the current year and the current date of week. Then, are there so
hello if you need to get the first day of the current week "monday"
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DAY_OF_MONTH, Calendar.MONDAY-calendar.get(Calendar.DAY_OF_WEEK));
Log.w(TAG, "first day of week" + calendar.getTime());
2 if you need the first day of the week for 20-12-2016
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.DAY_OF_MONTH, 20);
calendar.set(Calendar.MONTH,Calendar.DECEMBER);
calendar.set(Calendar.YEAR,2016);
calendar.add(Calendar.DAY_OF_MONTH,Calendar.MONDAY - calendar.get(Calendar.DAY_OF_WEEK));
Log.w(TAG,"first day of week:"+calendar.getTime());
i hope this will help you