Java Reference
In-Depth Information
Creates a
GregorianCalendar
object that represents the current
time in the given
timeZone
with the default locale.
public
GregorianCalendar(TimeZone zone, Locale locale)
Creates a
GregorianCalendar
object that represents the current
time in the given
timeZone
with the given
locale
.
In addition to the methods it inherits from
Calendar
,
GregorianCalendar
provides an
isLeapYear
method that returns
TRue
if the passed in year is
a leap year in that calendar.
The Gregorian calendar was preceded by the Julian calendar in many
places. In a
GregorianCalendar
object, the default date at which this
change happened is midnight local time on October 15, 1582. This
is when the first countries switched, but others changed later. The
getGregorianChange
method returns the time the calendar is currently us-
ing for the change as a
Date
. You can set a calendar's change-over time
by using
setGregorianChange
with a
Date
object.
The
SimpleTimeZone
class is a concrete subclass of
TimeZone
that expresses
values for Gregorian calendars. It does not handle historical complexit-
ies, but instead projects current practices onto all times. For historical
dates that precede the use of daylight saving time, for example, you
will want to use a calendar with a time zone you have selected that ig-
nores daylight saving time. For future dates,
SimpleTimeZone
is probably
as good a guess as any.