Some constants of GregorianCalendar.
1. GregorianCalendar.DECEMBER:
Syntax:
int java.util.Calendar.DECEMBER: 11
Value of the MONTH field indicates the twelfth month of the year in the Gregorian and Julian calendars.
2. GregorianCalendar.DST_OFFSET:
Syntax:
int java.util.Calendar.DST_OFFSET: 16
Field number for getting and set indicating the daylight saving offset in milliseconds.
3. GregorianCalendar.ERA:
Syntax:
int java.util.Calendar.ERA: 0
Field number for getting and set indicating the era, e.g., AD or BC in the Julian calendar.
4. GregorianCalendar.FEBRUARY:
Syntax:
int java.util.Calendar.FEBRUARY: 1
Value of the MONTH field indicates the second month of the year in the Gregorian and Julian calendars.
5. GregorianCalendar.FIELD_COUNT:
Syntax:
int java.util.Calendar.FIELD_COUNT: 17
The number of distinct fields is recognized by getting and setting.
6. GregorianCalendar.FRIDAY:
Syntax:
int java.util.Calendar.FRIDAY: 6
Value of the DAY_OF_WEEK field indicating Friday.
Approach
Java
import java.util.GregorianCalendar;public class GregorianCalendarConstant3 {public static void main(String[] args) {System.out.println(GregorianCalendar.DECEMBER);System.out.println(GregorianCalendar.DST_OFFSET);System.out.println(GregorianCalendar.ERA);System.out.println(GregorianCalendar.FEBRUARY);System.out.println(GregorianCalendar.FIELD_COUNT);System.out.println(GregorianCalendar.FRIDAY);}}
Output:
11 16 0 1 17 6
7. GregorianCalendar.PM:
Syntax:
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.
8. GregorianCalendar.SATURDAY:
Syntax:
int java.util.Calendar.SATURDAY: 7
Value of the DAY_OF_WEEK field indicating Saturday.
9. GregorianCalendar.SECOND:
Syntax:
int java.util.Calendar.SECOND: 13
Field number for getting and set indicating the second within the minute.
10. GregorianCalendar.SEPTEMBER:
Syntax:
int java.util.Calendar.SEPTEMBER: 8
Value of the MONTH field indicates the ninth month of the year in the Gregorian and Julian calendars.
11. GregorianCalendar.SHORT:
Syntax:
int java.util.Calendar.SHORT: 1
A style specifier for getDisplayName and getDisplayNames equivalent to SHORT_FORMAT.
12. GregorianCalendar.SHORT_FORMAT:
Syntax:
int java.util.Calendar.SHORT_FORMAT: 1
A style specifier for getDisplayName and getDisplayNames indicating a short name used for format.
13. GregorianCalendar.SHORT_STANDALONE:
Syntax:
int java.util.Calendar.SHORT_STANDALONE: 32769
A style specifier for getDisplayName and getDisplayNames indicates a short name used independently.
14. GregorianCalendar.SUNDAY:
Syntax:
int java.util.Calendar.SUNDAY: 1
Value of the DAY_OF_WEEK field indicating Sunday.
Approach
Java
import java.util.GregorianCalendar;public class GregorianCalendarConstant7 {public static void main(String[] args) {System.out.println(GregorianCalendar.PM);System.out.println(GregorianCalendar.SATURDAY);System.out.println(GregorianCalendar.SECOND);System.out.println(GregorianCalendar.SEPTEMBER);System.out.println(GregorianCalendar.SHORT);System.out.println(GregorianCalendar.SHORT_FORMAT);System.out.println(GregorianCalendar.SHORT_STANDALONE);System.out.println(GregorianCalendar.SUNDAY);}}
Output:
1 7 13 8 1 1 32769 1
No comments:
Post a Comment