Example usage for org.apache.commons.lang.time DateUtils RANGE_WEEK_MONDAY

List of usage examples for org.apache.commons.lang.time DateUtils RANGE_WEEK_MONDAY

Introduction

In this page you can find the example usage for org.apache.commons.lang.time DateUtils RANGE_WEEK_MONDAY.

Prototype

int RANGE_WEEK_MONDAY

To view the source code for org.apache.commons.lang.time DateUtils RANGE_WEEK_MONDAY.

Click Source Link

Document

A week range, starting on Monday.

Usage

From source file:MainClass.java

public static void main(String[] args) {
    StopWatch stWatch = new StopWatch();

    //Start StopWatch
    stWatch.start();/*from w w w  .j a v a  2  s.co m*/

    //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());

}

From source file:TimeTrial.java

public static void main(String[] args) {

    StopWatch stWatch = new StopWatch();

    // Start StopWatch
    stWatch.start();/*from  w  ww.j  a v a  2 s.c  o m*/

    // 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());

}

From source file:DateUtilsV1.java

 public static void main(String args[]) {
   GregorianCalendar calendar = new GregorianCalendar(1974, 5, 25, 6, 30, 30);
   Date date = calendar.getTime();

   System.err.println("Original Date: " + date);
   System.err.println("Rounded Date: " + DateUtils.round(date, Calendar.HOUR));
   System.err.println("Truncated Date: " +   DateUtils.truncate(date, Calendar.MONTH));

   Iterator itr = DateUtils.iterator(date, DateUtils.RANGE_WEEK_MONDAY);

   while(itr.hasNext()) {
      System.err.println(((Calendar)itr.next()).getTime());
   }/*  w  w  w . ja v a 2 s  .  c  o  m*/
}