Example usage for java.util Calendar MAY

List of usage examples for java.util Calendar MAY

Introduction

In this page you can find the example usage for java.util Calendar MAY.

Prototype

int MAY

To view the source code for java.util Calendar MAY.

Click Source Link

Document

Value of the #MONTH field indicating the fifth month of the year in the Gregorian and Julian calendars.

Usage

From source file:Main.java

public static void main(String args[]) {

    SimpleTimeZone stobj = new SimpleTimeZone(-28800000, "India", Calendar.MAY, 1, -Calendar.SUNDAY, 7200000,
            Calendar.OCTOBER, -1, Calendar.MONDAY, 7200000, 3600000);

    // setting DST saving time
    stobj.setDSTSavings(5400000);//  w  ww .j  a v a  2  s  . co m

    // checking the value      
    System.out.println("DST saving value : " + stobj.getDSTSavings());
}

From source file:Main.java

public static void main(String args[]) {

    SimpleTimeZone stobj = new SimpleTimeZone(820, "GMT");

    // checking the initial value      
    System.out.println("Initial value : " + stobj);

    // setting end rule
    stobj.setEndRule(Calendar.MAY, 2, Calendar.TUESDAY, 3600000, true);

    // checking the new value      
    System.out.println("New value : " + stobj);
}

From source file:Main.java

public static void main(String args[]) {

    SimpleTimeZone stobj = new SimpleTimeZone(820, "GMT");

    // checking the initial value      
    System.out.println("Initial value : " + stobj);

    // setting end rule
    stobj.setEndRule(Calendar.MAY, 2, Calendar.TUESDAY, 3600000);

    // checking the new value      
    System.out.println("New value : " + stobj);
}

From source file:Main.java

public static void main(String args[]) {

    SimpleTimeZone stobj = new SimpleTimeZone(820, "US");

    // checking initial value     
    System.out.println("Initial value: " + stobj);

    // setting start rule   
    stobj.setStartRule(Calendar.MAY, 2, 2, 3600000, true);

    // checking the new value      
    System.out.println("Final value : " + stobj);
}

From source file:Main.java

public static void main(String args[]) {

    SimpleTimeZone stobj = new SimpleTimeZone(820, "GMT");

    // checking initial value     
    System.out.println("Initial value: " + stobj);

    // setting start rule   
    stobj.setStartRule(Calendar.MAY, 2, 2, 3600000);

    // checking the new value      
    System.out.println("Final value : " + stobj);
}

From source file:Main.java

public static void main(String args[]) {

    SimpleTimeZone stobj = new SimpleTimeZone(820, "GMT");

    // checking initial value     
    System.out.println("Initial value: " + stobj);

    // setting start rule   
    stobj.setStartRule(Calendar.MAY, 2, 3600000);

    // checking the new value      
    System.out.println("Final value : " + stobj);
}

From source file:Main.java

public static void main(String args[]) {

    SimpleTimeZone stobj = new SimpleTimeZone(-28800000, "America/Los_Angeles", Calendar.AUGUST, 1,
            -Calendar.SUNDAY, 7200000, Calendar.DECEMBER, -1, Calendar.SUNDAY, 7200000, 3600000);

    // checking the initial value      
    System.out.println("Initial value : " + stobj);

    // setting end rule
    stobj.setEndRule(Calendar.MAY, 2, Calendar.TUESDAY, 3600000);

    // checking the new value      
    System.out.println("New value : " + stobj);
}

From source file:Main.java

public static void main(String[] args) {
    Calendar now = Calendar.getInstance();
    System.out.println(now.getTime());
    int month = now.get(Calendar.MONTH);
    if (month == Calendar.JANUARY) {
        System.out.println("JANUARY");
    }/*from www  .  ja va 2 s  .com*/
    if (month == Calendar.FEBRUARY) {
        System.out.println("FEBRUARY");
    }
    if (month == Calendar.MARCH) {
        System.out.println("MARCH");
    }
    if (month == Calendar.APRIL) {
        System.out.println("APRIL");
    }
    if (month == Calendar.MAY) {
        System.out.println("MAY");
    }
    if (month == Calendar.JUNE) {
        System.out.println("JUNE");
    }
    if (month == Calendar.JULY) {
        System.out.println("JULY");
    }
    if (month == Calendar.AUGUST) {
        System.out.println("AUGUST");
    }
    if (month == Calendar.SEPTEMBER) {
        System.out.println("SEPTEMBER");
    }
    if (month == Calendar.OCTOBER) {
        System.out.println("OCTOBER");
    }
    if (month == Calendar.NOVEMBER) {
        System.out.println("NOVEMBER");
    }
    if (month == Calendar.DECEMBER) {
        System.out.println("DECEMBER");
    }

}

From source file:Main.java

public static String getMonthString(int month) {
    switch (month) {
    case Calendar.JANUARY:
        return "Jan";
    case Calendar.FEBRUARY:
        return "Feb";
    case Calendar.MARCH:
        return "Mar";
    case Calendar.APRIL:
        return "Apr";
    case Calendar.MAY:
        return "May";
    case Calendar.JUNE:
        return "Jun";
    case Calendar.JULY:
        return "Jul";
    case Calendar.AUGUST:
        return "Aug";
    case Calendar.SEPTEMBER:
        return "Sep";
    case Calendar.OCTOBER:
        return "Oct";
    case Calendar.NOVEMBER:
        return "Nov";
    case Calendar.DECEMBER:
        return "Dec";
    default:/*from  w  w  w  .j a  v a2 s  .  c  o  m*/
        return "";
    }
}

From source file:Main.java

public static int getDaysInMonth(int month, int year) {
    switch (month) {
    case Calendar.JANUARY:
    case Calendar.MARCH:
    case Calendar.MAY:
    case Calendar.JULY:
    case Calendar.AUGUST:
    case Calendar.OCTOBER:
    case Calendar.DECEMBER:
        return 31;
    case Calendar.APRIL:
    case Calendar.JUNE:
    case Calendar.SEPTEMBER:
    case Calendar.NOVEMBER:
        return 30;
    case Calendar.FEBRUARY:
        return (year % 4 == 0) ? 29 : 28;
    default:/*  w  ww . j  ava2 s  .c om*/
        throw new IllegalArgumentException("Invalid Month");
    }
}