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

public Class DateTimeRule

extends Object
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Imports
java.io.Serializable

DateTimeRule is a class representing a time in a year by a rule specified by month, day of month, day of week and time in the day.
ICU Status
Stable since ICU 3.8.

Field Summary

Modifier and TypeField and Description
private final int
private final int
private final int
public static final int
DOM

Date rule type defined by exact day of month.

public static final int
DOW

Date rule type defined by day of week in month.

public static final int
DOW_GEQ_DOM

Date rule type defined by first day of week on or after exact day of month.

public static final int
DOW_LEQ_DOM

Date rule type defined by last day of week on or before exact day of month.

private static final String[]
private final int
private static final String[]
private final int
private static final long
public static final int
STANDARD_TIME

Time rule type for local standard time.

private final int
public static final int
UTC_TIME

Time rule type for coordinated universal time.

public static final int
WALL_TIME

Time rule type for local wall time.

private final int

Constructor Summary

AccessConstructor and Description
public
DateTimeRule(int
The rule month, for example, Calendar.JANUARY
month
,
int
The day of month, 1-based.
dayOfMonth
,
int
The milliseconds in the rule date.
millisInDay
,
int
The time type, WALL_TIME or STANDARD_TIME or UTC_TIME.
timeType
)

Constructs a DateTimeRule by the day of month and the time rule.

public
DateTimeRule(int
The rule month, for example, Calendar.JANUARY.
month
,
int
The ordinal number of the day of week. Negative number may be used for specifying a rule date counted from the end of the rule month.
weekInMonth
,
int
The day of week, for example, Calendar.SUNDAY.
dayOfWeek
,
int
The milliseconds in the rule date.
millisInDay
,
int
The time type, WALL_TIME or STANDARD_TIME or UTC_TIME.
timeType
)

Constructs a DateTimeRule by the day of week and its ordinal number and the time rule.

public
DateTimeRule(int
The rule month, for example, Calendar.JANUARY
month
,
int
The day of month, 1-based.
dayOfMonth
,
int
The day of week, for example, Calendar.SUNDAY.
dayOfWeek
,
boolean
true if the rule date is on or after the day of month.
after
,
int
The milliseconds in the rule date.
millisInDay
,
int
The time type, WALL_TIME or STANDARD_TIME or UTC_TIME.
timeType
)

Constructs a DateTimeRule by the first/last day of week on or after/before the day of month and the time rule.

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

The date rule type.
getDateRuleType
()

Gets the date rule type, such as DOM

public int

Returns:

The rule day of month
getRuleDayOfMonth
()

Gets the rule day of month.

public int

Returns:

The rule day of week.
getRuleDayOfWeek
()

Gets the rule day of week.

public int

Returns:

The time in the rule day in milliseconds.
getRuleMillisInDay
()

Gets the rule time in the rule day.

public int

Returns:

The rule month.
getRuleMonth
()

Gets the rule month.

public int

Returns:

The rule day of week ordinal number in the month.
getRuleWeekInMonth
()

Gets the rule day of week ordinal number in the month.

public int

Returns:

The time rule type, either WALL_TIME or STANDARD_TIME or UTC_TIME.
getTimeRuleType
()

Gets the time rule type

public String
toString()

Overrides java.lang.Object.toString.

Returns a String representation of this DateTimeRule object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

dateRuleTypeback to summary
private final int dateRuleType
dayOfMonthback to summary
private final int dayOfMonth
dayOfWeekback to summary
private final int dayOfWeek
DOMback to summary
public static final int DOM

Date rule type defined by exact day of month. For example, March 14.

ICU Status
Stable since ICU 3.8.
DOWback to summary
public static final int DOW

Date rule type defined by day of week in month. For example, 2nd Sunday in March.

ICU Status
Stable since ICU 3.8.
DOW_GEQ_DOMback to summary
public static final int DOW_GEQ_DOM

Date rule type defined by first day of week on or after exact day of month. For example, 1st Monday on or after March 15.

ICU Status
Stable since ICU 3.8.
DOW_LEQ_DOMback to summary
public static final int DOW_LEQ_DOM

Date rule type defined by last day of week on or before exact day of month. For example, last Saturday on or before March 15.

ICU Status
Stable since ICU 3.8.
DOWSTRback to summary
private static final String[] DOWSTR
millisInDayback to summary
private final int millisInDay
MONSTRback to summary
private static final String[] MONSTR
monthback to summary
private final int month
serialVersionUIDback to summary
private static final long serialVersionUID
STANDARD_TIMEback to summary
public static final int STANDARD_TIME

Time rule type for local standard time.

ICU Status
Stable since ICU 3.8.
timeRuleTypeback to summary
private final int timeRuleType
UTC_TIMEback to summary
public static final int UTC_TIME

Time rule type for coordinated universal time.

ICU Status
Stable since ICU 3.8.
WALL_TIMEback to summary
public static final int WALL_TIME

Time rule type for local wall time.

ICU Status
Stable since ICU 3.8.
weekInMonthback to summary
private final int weekInMonth

Constructor Detail

DateTimeRuleback to summary
public DateTimeRule(int month, int dayOfMonth, int millisInDay, int timeType)

Constructs a DateTimeRule by the day of month and the time rule. The date rule type for an instance created by this constructor is DOM.

Parameters
month:int

The rule month, for example, Calendar.JANUARY

dayOfMonth:int

The day of month, 1-based.

millisInDay:int

The milliseconds in the rule date.

timeType:int

The time type, WALL_TIME or STANDARD_TIME or UTC_TIME.

ICU Status
Stable since ICU 3.8.
DateTimeRuleback to summary
public DateTimeRule(int month, int weekInMonth, int dayOfWeek, int millisInDay, int timeType)

Constructs a DateTimeRule by the day of week and its ordinal number and the time rule. The date rule type for an instance created by this constructor is DOW.

Parameters
month:int

The rule month, for example, Calendar.JANUARY.

weekInMonth:int

The ordinal number of the day of week. Negative number may be used for specifying a rule date counted from the end of the rule month.

dayOfWeek:int

The day of week, for example, Calendar.SUNDAY.

millisInDay:int

The milliseconds in the rule date.

timeType:int

The time type, WALL_TIME or STANDARD_TIME or UTC_TIME.

ICU Status
Stable since ICU 3.8.
DateTimeRuleback to summary
public DateTimeRule(int month, int dayOfMonth, int dayOfWeek, boolean after, int millisInDay, int timeType)

Constructs a DateTimeRule by the first/last day of week on or after/before the day of month and the time rule. The date rule type for an instance created by this constructor is either DOM_GEQ_DOM or DOM_LEQ_DOM.

Parameters
month:int

The rule month, for example, Calendar.JANUARY

dayOfMonth:int

The day of month, 1-based.

dayOfWeek:int

The day of week, for example, Calendar.SUNDAY.

after:boolean

true if the rule date is on or after the day of month.

millisInDay:int

The milliseconds in the rule date.

timeType:int

The time type, WALL_TIME or STANDARD_TIME or UTC_TIME.

ICU Status
Stable since ICU 3.8.

Method Detail

getDateRuleTypeback to summary
public int getDateRuleType()

Gets the date rule type, such as DOM

Returns:int

The date rule type.

ICU Status
Stable since ICU 3.8.
getRuleDayOfMonthback to summary
public int getRuleDayOfMonth()

Gets the rule day of month. When the date rule type is DOW, the value is always 0.

Returns:int

The rule day of month

ICU Status
Stable since ICU 3.8.
getRuleDayOfWeekback to summary
public int getRuleDayOfWeek()

Gets the rule day of week. When the date rule type is DOM, the value is always 0.

Returns:int

The rule day of week.

ICU Status
Stable since ICU 3.8.
getRuleMillisInDayback to summary
public int getRuleMillisInDay()

Gets the rule time in the rule day.

Returns:int

The time in the rule day in milliseconds.

ICU Status
Stable since ICU 3.8.
getRuleMonthback to summary
public int getRuleMonth()

Gets the rule month.

Returns:int

The rule month.

ICU Status
Stable since ICU 3.8.
getRuleWeekInMonthback to summary
public int getRuleWeekInMonth()

Gets the rule day of week ordinal number in the month. When the date rule type is not DOW, the value is always 0.

Returns:int

The rule day of week ordinal number in the month.

ICU Status
Stable since ICU 3.8.
getTimeRuleTypeback to summary
public int getTimeRuleType()

Gets the time rule type

Returns:int

The time rule type, either WALL_TIME or STANDARD_TIME or UTC_TIME.

ICU Status
Stable since ICU 3.8.
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Returns a String representation of this DateTimeRule object. This method is used for debugging purpose only. The string representation can be changed in future version of ICU without any notice.

Returns:String

Doc from java.lang.Object.toString.

a string representation of the object.

Annotations
@Override
ICU Status
Stable since ICU 3.8.