import java.util.Calendar;
import java.util.Date;
import java.util.Iterator;
import org.apache.commons.lang.time.DateUtils;
import org.apache.commons.lang.time.StopWatch;
public class MainClass {
public static void main(String[] args) {
StopWatch stWatch = new StopWatch();
//Start StopWatch
stWatch.start();
//Get iterator for all days in a week starting Monday
Iterator itr = DateUtils.iterator(new Date(),
DateUtils.RANGE_WEEK_MONDAY);
while (itr.hasNext()) {
Calendar gCal = (Calendar) itr.next();
System.out.println(gCal.getTime());
}
//Stop StopWatch
stWatch.stop();
System.out.println("Time Taken >>" + stWatch.getTime());
}
}
|