Calendar class constants in Java Part -III

1. Calendar.NARROW_STANDALONE

int java.util.Calendar.NARROW_STANDALONE: 32772

A style specifier for getDisplayName and getDisplayNames indicates a narrow name independently.

2. Calendar.PM 

int java.util.Calendar.PM: 1

The value of the AM_PM field indicates the period of the day from noon to just before midnight.

3. Calendar.SECOND

int java.util.Calendar.SECOND: 13

Field number for getting and set indicating the second within the minute.

4. Calendar.SHORT

int java.util.Calendar.SHORT: 1

A style specifier for getDisplayName and getDisplayNames equivalent to SHORT_FORMAT.

5.Calendar.SHORT_STANDALON

int java.util.Calendar.SHORT_STANDALONE: 32769

A style specifier for getDisplayName and getDisplayNames indicating a short name is used independently, such as a month abbreviation as calendar headers.

Approach

Java

import java.util.Calendar;

public class CalendarConstans3 {
    public static void main(String[] args) {
        System.out.println(Calendar.NARROW_STANDALONE);

        System.out.println(Calendar.PM);

        System.out.println(Calendar.SECOND);

        System.out.println(Calendar.SHORT);

        System.out.println(Calendar.SHORT_STANDALONE);

    }
}

Output:

32772 1 13 1 32769


6. Calendar.UNDECIMBER

int java.util.Calendar.UNDECIMBER: 12

The value of the MONTH field indicates the thirteenth month of the year.

7. Calendar.WEEK_OF_MONTH

int java.util.Calendar.WEEK_OF_MONTH: 4

Field number for getting and set indicating the week number within the current month.

8. Calendar.WEEK_OF_YEAR

int java.util.Calendar.WEEK_OF_YEAR: 3

Field number for getting and set indicating the week number within the current year.

9. Calendar.YEAR

int java.util.Calendar.YEAR: 1

Field number for getting and set indicating the year.

10. Calendar.ZONE_OFFSET

int java.util.Calendar.ZONE_OFFSET: 15

Field number for getting and set indicating the raw offset from GMT in milliseconds.

Approach

Java

import java.util.Calendar;

public class CalendarConstans3 {
    public static void main(String[] args) {
 
        System.out.println(Calendar.UNDECIMBER);

        System.out.println(Calendar.WEEK_OF_MONTH);
        System.out.println(Calendar.WEEK_OF_YEAR);
        System.out.println(Calendar.YEAR);

        System.out.println(Calendar.ZONE_OFFSET);
    }
}

Output:

12 4 3 1 15


No comments:

Post a Comment