Gregorian Calendar Java Help

Gregorian Calendar

Gregorian Calendar is a concrete implementation of a Calendar that implements the normal Gregorian calendar with which you are familiar. The getInstance( ) method of 'Calendar returns a Gregorian Calendar initialized with the current date and time the default locale and time zone. GregorianCalendar defines two fields D and BC..These represent the two eras defined by the Gregorian calendar.There are also several constructors  for GregorianCalendar objects. The default, GregorianCalendar(), initializes the object with the current date and time in the default locale and time zone. Three more constructors offer increasing levels of specificity Gregorian Calendar(int yen, int month, int day Of Moll) Gregorian Calendar (int,year, int month, int day Of Month, int Hours, hit minutes) Gregorian Calendar(int yen, int month, int day of Mon ll, int hours, int minutes, 'int seconds) i'll- three versions set the day, month, and year. Here, yenr specifies the number of years that have elapsed since 1900.The month is specified by month, with zero indicating January. The day of the month is specified by dny Of Montell. The first version sets the time to midnight. TIle second, version also sets the hours and the minutes. The third version adds seconds.

 You can also construct a GregorianCalendar object by specifying either the locale and/ or time zone. The following constructors create objects initialized with the current date and time using the specified time zone and/ or locale: Gregorian Calendar(Locale locale) ,Gregorian Calendar; trad (Time Zone timezone)  Gregorian Garibaldi (Time Zone time Zone, Locale locale). " Gregorian Calendar provides an implementation of all the abstract methods in Calendar. It also provides some additional methods. Perhaps the'most interesting is isLeapYear(), which tests'if the year is a leap year. Its form is " boolean is Leap Year(int year) This method returns true if yenr is a leap year and false otherwise. The following program demonstrates Gregorian Calendar:

Posted on September 17, 2014 in java.util More Utility Classes

Share the Story

About the Author

Back to Top
Share This