How to get all week dates for given date java -


i have date , how dates fall on week given date belongs in java?

example:  if give today's date should dates belonging week.  12 july 2015 18 july 2015 

could 1 me please.

i trying week dates given date, have given explanation why question not duplicate, please read before commenting.

you can try following way,

calendar cal = calendar.getinstance(); //cal.settime(new date());//set specific date if want  for(int = calendar.sunday; <= calendar.saturday; i++) {     cal.set(calendar.day_of_week, i);     system.out.println(cal.gettime());//returns date } 

output

sun jul 12 08:12:38 ist 2015 mon jul 13 08:12:38 ist 2015 tue jul 14 08:12:38 ist 2015 wed jul 15 08:12:38 ist 2015 thu jul 16 08:12:38 ist 2015 fri jul 17 08:12:38 ist 2015 sat jul 18 08:12:38 ist 2015 

Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -