Package com.squarespace.cldrengine.api
Class GregorianDate
- java.lang.Object
-
- com.squarespace.cldrengine.api.CalendarDate
-
- com.squarespace.cldrengine.api.GregorianDate
-
- Direct Known Subclasses:
BuddhistDate
,ISO8601Date
,JapaneseDate
public class GregorianDate extends CalendarDate
Construct a date using the rules of the Gregorian calendar. type: gregory
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.squarespace.cldrengine.api.CalendarDate
CalendarDate.Swap
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
GregorianDate(CalendarType type, int firstDay, int minDays)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected GregorianDate
_initFromJD(long jd, long msDay, java.lang.String zoneId)
protected GregorianDate
_initFromUnixEpoch(long epoch, java.lang.String zoneId)
GregorianDate
add(TimePeriod fields)
protected void
computeGregorianFields(long[] f)
Compute fields for dates on or after the Gregorian cutover.protected void
computeJulianFields(long[] f)
Compute fields for dates before the Gregorian cutover using the proleptic Julian calendar.protected int
daysInMonth(long year, int month)
protected int
daysInYear(long year)
static GregorianDate
fromUnixEpoch(long epoch, java.lang.String zoneId, int firstDay, int minDays)
protected void
initFields(long[] f)
protected boolean
leapGregorian(long year)
Return true if the given year is a leap year in the Gregorian calendar; false otherwise.protected int
monthCount()
protected long
monthStart(long eyear, double month, boolean useMonth)
GregorianDate
subtract(TimePeriod fields)
java.lang.String
toString()
GregorianDate
withZone(java.lang.String zoneId)
-
Methods inherited from class com.squarespace.cldrengine.api.CalendarDate
_add, _addTime, _computeWeekFields, _diff, _rollup, _toString, checkJDRange, compare, computeBaseFields, computeWeekFields, dayOfMonth, dayOfWeek, dayOfWeekInMonth, dayOfYear, difference, era, extendedYear, fieldOfVisualDifference, firstDayOfWeek, getRelativeField, hour, hourOfDay, initFromJD, initFromUnixEpoch, invertPeriod, isAM, isDaylightSavings, isLeapYear, jdFromUnixEpoch, julianDay, largestRelativeField, metaZoneId, milliseconds, millisecondsInDay, minDaysInFirstWeek, minute, modifiedJulianDay, month, ordinalDayOfWeek, relatedYear, relativeTime, second, splitfrac, swap, timePeriodFieldFlags, timeZoneAbbr, timeZoneId, timeZoneOffset, timeZoneStableId, type, unixEpoch, unixEpochFromJD, utcfields, weekNumber, weekOfMonth, weekOfYear, weekOfYearISO, year, yearLength, yearOfWeekOfYear, yearOfWeekOfYearISO
-
-
-
-
Constructor Detail
-
GregorianDate
protected GregorianDate(CalendarType type, int firstDay, int minDays)
-
-
Method Detail
-
fromUnixEpoch
public static GregorianDate fromUnixEpoch(long epoch, java.lang.String zoneId, int firstDay, int minDays)
-
add
public GregorianDate add(TimePeriod fields)
- Specified by:
add
in classCalendarDate
-
subtract
public GregorianDate subtract(TimePeriod fields)
- Specified by:
subtract
in classCalendarDate
-
withZone
public GregorianDate withZone(java.lang.String zoneId)
- Specified by:
withZone
in classCalendarDate
-
daysInMonth
protected int daysInMonth(long year, int month)
- Specified by:
daysInMonth
in classCalendarDate
-
daysInYear
protected int daysInYear(long year)
- Specified by:
daysInYear
in classCalendarDate
-
monthCount
protected int monthCount()
- Specified by:
monthCount
in classCalendarDate
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
_initFromUnixEpoch
protected GregorianDate _initFromUnixEpoch(long epoch, java.lang.String zoneId)
-
_initFromJD
protected GregorianDate _initFromJD(long jd, long msDay, java.lang.String zoneId)
-
initFields
protected void initFields(long[] f)
- Specified by:
initFields
in classCalendarDate
-
monthStart
protected long monthStart(long eyear, double month, boolean useMonth)
- Specified by:
monthStart
in classCalendarDate
-
computeGregorianFields
protected void computeGregorianFields(long[] f)
Compute fields for dates on or after the Gregorian cutover.
-
computeJulianFields
protected void computeJulianFields(long[] f)
Compute fields for dates before the Gregorian cutover using the proleptic Julian calendar. Any Gregorian date before October 15, 1582 is really a date on the proleptic Julian calendar, with leap years every 4 years.
-
leapGregorian
protected boolean leapGregorian(long year)
Return true if the given year is a leap year in the Gregorian calendar; false otherwise. Note that we switch to the Julian calendar at the Gregorian cutover year.
-
-