Package com.ibm.icu.util
Class DateTimeRule
- java.lang.Object
-
- com.ibm.icu.util.DateTimeRule
-
- All Implemented Interfaces:
java.io.Serializable
public class DateTimeRule extends java.lang.Object implements 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.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static int
DOM
Date rule type defined by exact day of month.static int
DOW
Date rule type defined by day of week in month.static int
DOW_GEQ_DOM
Date rule type defined by first day of week on or after exact day of month.static int
DOW_LEQ_DOM
Date rule type defined by last day of week on or before exact day of month.static int
STANDARD_TIME
Time rule type for local standard time.static int
UTC_TIME
Time rule type for coordinated universal time.static int
WALL_TIME
Time rule type for local wall time.
-
Constructor Summary
Constructors Constructor Description DateTimeRule(int month, int dayOfMonth, int dayOfWeek, boolean after, int millisInDay, int timeType)
Constructs aDateTimeRule
by the first/last day of week on or after/before the day of month and the time rule.DateTimeRule(int month, int dayOfMonth, int millisInDay, int timeType)
Constructs aDateTimeRule
by the day of month and the time rule.DateTimeRule(int month, int weekInMonth, int dayOfWeek, int millisInDay, int timeType)
Constructs aDateTimeRule
by the day of week and its oridinal number and the time rule.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getDateRuleType()
Gets the date rule type, such asDOM
int
getRuleDayOfMonth()
Gets the rule day of month.int
getRuleDayOfWeek()
Gets the rule day of week.int
getRuleMillisInDay()
Gets the rule time in the rule day.int
getRuleMonth()
Gets the rule month.int
getRuleWeekInMonth()
Gets the rule day of week ordinal number in the month.int
getTimeRuleType()
Gets the time rule typejava.lang.String
toString()
Returns aString
representation of thisDateTimeRule
object.
-
-
-
Field Detail
-
DOM
public static final int DOM
Date rule type defined by exact day of month. For example, March 14.- See Also:
- Constant Field Values
-
DOW
public static final int DOW
Date rule type defined by day of week in month. For example, 2nd Sunday in March.- See Also:
- Constant Field Values
-
DOW_GEQ_DOM
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.- See Also:
- Constant Field Values
-
DOW_LEQ_DOM
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.- See Also:
- Constant Field Values
-
WALL_TIME
public static final int WALL_TIME
Time rule type for local wall time.- See Also:
- Constant Field Values
-
STANDARD_TIME
public static final int STANDARD_TIME
Time rule type for local standard time.- See Also:
- Constant Field Values
-
UTC_TIME
public static final int UTC_TIME
Time rule type for coordinated universal time.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DateTimeRule
public DateTimeRule(int month, int dayOfMonth, int millisInDay, int timeType)
Constructs aDateTimeRule
by the day of month and the time rule. The date rule type for an instance created by this constructor isDOM
.- Parameters:
month
- The rule month, for example,Calendar.JANUARY
dayOfMonth
- The day of month, 1-based.millisInDay
- The milliseconds in the rule date.timeType
- The time type,WALL_TIME
orSTANDARD_TIME
orUTC_TIME
.
-
DateTimeRule
public DateTimeRule(int month, int weekInMonth, int dayOfWeek, int millisInDay, int timeType)
Constructs aDateTimeRule
by the day of week and its oridinal number and the time rule. The date rule type for an instance created by this constructor isDOW
.- Parameters:
month
- The rule month, for example,Calendar.JANUARY
.weekInMonth
- 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
- The day of week, for example,Calendar.SUNDAY
.millisInDay
- The milliseconds in the rule date.timeType
- The time type,WALL_TIME
orSTANDARD_TIME
orUTC_TIME
.
-
DateTimeRule
public DateTimeRule(int month, int dayOfMonth, int dayOfWeek, boolean after, int millisInDay, int timeType)
Constructs aDateTimeRule
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 eitherDOM_GEQ_DOM
orDOM_LEQ_DOM
.- Parameters:
month
- The rule month, for example,Calendar.JANUARY
dayOfMonth
- The day of month, 1-based.dayOfWeek
- The day of week, for example,Calendar.SUNDAY
.after
- true if the rule date is on or after the day of month.millisInDay
- The milliseconds in the rule date.timeType
- The time type,WALL_TIME
orSTANDARD_TIME
orUTC_TIME
.
-
-
Method Detail
-
getDateRuleType
public int getDateRuleType()
Gets the date rule type, such asDOM
- Returns:
- The date rule type.
-
getRuleMonth
public int getRuleMonth()
Gets the rule month.- Returns:
- The rule month.
-
getRuleDayOfMonth
public int getRuleDayOfMonth()
Gets the rule day of month. When the date rule type isDOW
, the value is always 0.- Returns:
- The rule day of month
-
getRuleDayOfWeek
public int getRuleDayOfWeek()
Gets the rule day of week. When the date rule type isDOM
, the value is always 0.- Returns:
- The rule day of week.
-
getRuleWeekInMonth
public int getRuleWeekInMonth()
Gets the rule day of week ordinal number in the month. When the date rule type is notDOW
, the value is always 0.- Returns:
- The rule day of week ordinal number in the month.
-
getTimeRuleType
public int getTimeRuleType()
Gets the time rule type- Returns:
- The time rule type, either
WALL_TIME
orSTANDARD_TIME
orUTC_TIME
.
-
getRuleMillisInDay
public int getRuleMillisInDay()
Gets the rule time in the rule day.- Returns:
- The time in the rule day in milliseconds.
-
toString
public java.lang.String toString()
Returns aString
representation of thisDateTimeRule
object. This method is used for debugging purpose only. The string representation can be changed in future version of ICU without any notice.- Overrides:
toString
in classjava.lang.Object
-
-