public class DateTimeRule extends Object implements 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.Modifier and Type | Field and 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 and Description |
---|
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. |
DateTimeRule(int month,
int dayOfMonth,
int millisInDay,
int timeType)
Constructs a
DateTimeRule by the day of month and
the time rule. |
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. |
Modifier and Type | Method and Description |
---|---|
int |
getDateRuleType()
Gets the date rule type, such as
DOM |
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 type
|
String |
toString()
Returns a
String representation of this DateTimeRule object. |
public static final int DOM
public static final int DOW
public static final int DOW_GEQ_DOM
public static final int DOW_LEQ_DOM
public static final int WALL_TIME
public static final int STANDARD_TIME
public static final int UTC_TIME
public DateTimeRule(int month, int dayOfMonth, int millisInDay, int timeType)
DateTimeRule
by the day of month and
the time rule. The date rule type for an instance created by
this constructor is DOM
.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
or STANDARD_TIME
or UTC_TIME
.public DateTimeRule(int month, int weekInMonth, int dayOfWeek, int millisInDay, int timeType)
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
.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
or STANDARD_TIME
or UTC_TIME
.public DateTimeRule(int month, int dayOfMonth, int dayOfWeek, boolean after, int millisInDay, int timeType)
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
.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
or STANDARD_TIME
or UTC_TIME
.public int getDateRuleType()
DOM
public int getRuleMonth()
public int getRuleDayOfMonth()
DOW
, the value is always 0.public int getRuleDayOfWeek()
DOM
, the value is always 0.public int getRuleWeekInMonth()
DOW
, the value is
always 0.public int getTimeRuleType()
WALL_TIME
or STANDARD_TIME
or UTC_TIME
.public int getRuleMillisInDay()
Copyright © 2016 Unicode, Inc. and others.