Top Description Fields Constructors Methods
com.ibm.icu.impl

public Class Grego

extends Object
Class Inheritance
Imports
java.util.Locale

A utility class providing proleptic Gregorian calendar functions used by time zone and calendar code. Do not instantiate.

Note

Unlike GregorianCalendar, all computations performed by this class occur in the pure proleptic GregorianCalendar.

Field Summary

Modifier and TypeField and Description
private static final int[]
private static final int
private static final int
public static final long
public static final int
public static final int
public static final int
public static final int
public static final long
private static final int[]

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static int

Returns:

the day of week
dayOfWeek
(long
the 1970-epoch day (integral value)
day
)

Return the day of week on the 1970-epoch day

public static int[]
dayToFields(long day, int[] fields)

public static long

Returns:

the day number, with day 0 == Jan 1 1970
fieldsToDay
(int
Gregorian year, with 0 == 1 BCE, -1 == 2 BCE, etc.
year
,
int
0-based month, with 0==Jan
month
,
int
1-based day of month
dom
)

Convert a year, month, and day-of-month, given in the proleptic Gregorian calendar, to 1970 epoch days.

public static long
floorDivide(long numerator, long denominator)

private static long
floorDivide(long numerator, long denominator, long[] remainder)

public static int
getDayOfWeekInMonth(int year, int month, int dayOfMonth)

public static final boolean

Returns:

true if the year is a leap year
isLeapYear
(int
Gregorian year, with 0 == 1 BCE, -1 == 2 BCE, etc.
year
)

Return true if the given year is a leap year.

public static final int

Returns:

the number of days in the given month
monthLength
(int
Gregorian year, with 0 == 1 BCE, -1 == 2 BCE, etc.
year
,
int
0-based month, with 0==Jan
month
)

Return the number of days in the given month.

public static final int

Returns:

the number of days in the month previous to the given month
previousMonthLength
(int
Gregorian year, with 0 == 1 BCE, -1 == 2 BCE, etc.
year
,
int
0-based month, with 0==Jan
month
)

Return the length of a previous month of the Gregorian calendar.

public static int[]
timeToFields(long time, int[] fields)

public static String

Returns:

ISO-8601 date string
timeToString
(long
long time
time
)

Convenient method for formatting time to ISO 8601 style date string.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DAYS_BEFOREback to summary
private static final int[] DAYS_BEFORE
JULIAN_1970_CEback to summary
private static final int JULIAN_1970_CE
JULIAN_1_CEback to summary
private static final int JULIAN_1_CE
MAX_MILLISback to summary
public static final long MAX_MILLIS
MILLIS_PER_DAYback to summary
public static final int MILLIS_PER_DAY
MILLIS_PER_HOURback to summary
public static final int MILLIS_PER_HOUR
MILLIS_PER_MINUTEback to summary
public static final int MILLIS_PER_MINUTE
MILLIS_PER_SECONDback to summary
public static final int MILLIS_PER_SECOND
MIN_MILLISback to summary
public static final long MIN_MILLIS
MONTH_LENGTHback to summary
private static final int[] MONTH_LENGTH

Constructor Detail

Gregoback to summary
public Grego()

Method Detail

dayOfWeekback to summary
public static int dayOfWeek(long day)

Return the day of week on the 1970-epoch day

Parameters
day:long

the 1970-epoch day (integral value)

Returns:int

the day of week

dayToFieldsback to summary
public static int[] dayToFields(long day, int[] fields)
fieldsToDayback to summary
public static long fieldsToDay(int year, int month, int dom)

Convert a year, month, and day-of-month, given in the proleptic Gregorian calendar, to 1970 epoch days.

Parameters
year:int

Gregorian year, with 0 == 1 BCE, -1 == 2 BCE, etc.

month:int

0-based month, with 0==Jan

dom:int

1-based day of month

Returns:long

the day number, with day 0 == Jan 1 1970

floorDivideback to summary
public static long floorDivide(long numerator, long denominator)
floorDivideback to summary
private static long floorDivide(long numerator, long denominator, long[] remainder)
getDayOfWeekInMonthback to summary
public static int getDayOfWeekInMonth(int year, int month, int dayOfMonth)
isLeapYearback to summary
public static final boolean isLeapYear(int year)

Return true if the given year is a leap year.

Parameters
year:int

Gregorian year, with 0 == 1 BCE, -1 == 2 BCE, etc.

Returns:boolean

true if the year is a leap year

monthLengthback to summary
public static final int monthLength(int year, int month)

Return the number of days in the given month.

Parameters
year:int

Gregorian year, with 0 == 1 BCE, -1 == 2 BCE, etc.

month:int

0-based month, with 0==Jan

Returns:int

the number of days in the given month

previousMonthLengthback to summary
public static final int previousMonthLength(int year, int month)

Return the length of a previous month of the Gregorian calendar.

Parameters
year:int

Gregorian year, with 0 == 1 BCE, -1 == 2 BCE, etc.

month:int

0-based month, with 0==Jan

Returns:int

the number of days in the month previous to the given month

timeToFieldsback to summary
public static int[] timeToFields(long time, int[] fields)
timeToStringback to summary
public static String timeToString(long time)

Convenient method for formatting time to ISO 8601 style date string.

Parameters
time:long

long time

Returns:String

ISO-8601 date string