本文整理汇总了Java中com.ibm.icu.util.Calendar.DAY_OF_MONTH属性的典型用法代码示例。如果您正苦于以下问题:Java Calendar.DAY_OF_MONTH属性的具体用法?Java Calendar.DAY_OF_MONTH怎么用?Java Calendar.DAY_OF_MONTH使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.ibm.icu.util.Calendar
的用法示例。
在下文中一共展示了Calendar.DAY_OF_MONTH属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Frequency
/**
* @param start Starting date, defaults to current system time
* @param freqType One of the following integer values: <code>Calendar.SECOND
* Calendar.MINUTE Calendar.HOUR Calendar.DAY_OF_MONTH Calendar.MONTH
* Calendar.YEAR</code>
* @param freqCount A positive integer
*/
public Frequency(Date start, int freqType, int freqCount) {
if (freqType != Calendar.SECOND && freqType != Calendar.MINUTE
&& freqType != Calendar.HOUR && freqType != Calendar.DAY_OF_MONTH
&& freqType != Calendar.MONTH && freqType != Calendar.YEAR) {
throw new IllegalArgumentException("Invalid freqType argument");
}
if (freqCount < 1) {
throw new IllegalArgumentException("freqCount argument must be a positive integer");
}
if (start != null) {
this.start = start;
} else {
this.start = new Date();
}
this.sequence = SEQUENCE_FREQ + freqType;
this.freqType = freqType;
this.freqCount = freqCount;
if (Debug.verboseOn()) {
Debug.logVerbose("Created " + this, module);
}
}
示例2: visit
@Override
public void visit(TemporalExpressions.Frequency expr) {
if (this.dateStart == null) {
this.dateStart = new DtStart(new net.fortuna.ical4j.model.Date(expr.getStartDate()));
}
int freqCount = expr.getFreqCount();
int freqType = expr.getFreqType();
switch (freqType) {
case Calendar.SECOND:
this.state.addRecur((new Recur(Recur.SECONDLY, freqCount)));
break;
case Calendar.MINUTE:
this.state.addRecur((new Recur(Recur.MINUTELY, freqCount)));
break;
case Calendar.HOUR:
this.state.addRecur((new Recur(Recur.HOURLY, freqCount)));
break;
case Calendar.DAY_OF_MONTH:
this.state.addRecur((new Recur(Recur.DAILY, freqCount)));
break;
case Calendar.MONTH:
this.state.addRecur((new Recur(Recur.MONTHLY, freqCount)));
break;
case Calendar.YEAR:
this.state.addRecur((new Recur(Recur.YEARLY, freqCount)));
break;
}
}
示例3: prepareCal
protected Calendar prepareCal(Calendar cal) {
// Performs a "sane" skip forward in time - avoids time consuming loops
// like incrementing every second from Jan 1 2000 until today
Calendar skip = (Calendar) cal.clone();
skip.setTime(this.start);
long deltaMillis = cal.getTimeInMillis() - this.start.getTime();
if (deltaMillis < 1000) {
return skip;
}
long divisor = deltaMillis;
if (this.freqType == Calendar.DAY_OF_MONTH) {
divisor = 86400000;
} else if (this.freqType == Calendar.HOUR) {
divisor = 3600000;
} else if (this.freqType == Calendar.MINUTE) {
divisor = 60000;
} else if (this.freqType == Calendar.SECOND) {
divisor = 1000;
} else {
return skip;
}
long units = deltaMillis / divisor;
units -= units % this.freqCount;
skip.add(this.freqType, (int)units);
while (skip.after(cal)) {
skip.add(this.freqType, -this.freqCount);
}
return skip;
}
示例4: setIntervalPattern
/**
* Provides a way for client to build interval patterns.
* User could construct DateIntervalInfo by providing
* a list of skeletons and their patterns.
* <P>
* For example:
* <pre>
* DateIntervalInfo dIntervalInfo = new DateIntervalInfo();
* dIntervalInfo.setIntervalPattern("yMd", Calendar.YEAR, "'from' yyyy-M-d 'to' yyyy-M-d");
* dIntervalInfo.setIntervalPattern("yMMMd", Calendar.MONTH, "'from' yyyy MMM d 'to' MMM d");
* dIntervalInfo.setIntervalPattern("yMMMd", Calendar.DAY, "yyyy MMM d-d");
* dIntervalInfo.setFallbackIntervalPattern("{0} ~ {1}");
* </pre>
*
* Restriction:
* Currently, users can only set interval patterns when the following
* calendar fields are different: ERA, YEAR, MONTH, DATE, DAY_OF_MONTH,
* DAY_OF_WEEK, AM_PM, HOUR, HOUR_OF_DAY, MINUTE, and SECOND.
* Interval patterns when other calendar fields are different are
* not supported.
*
* @param skeleton the skeleton on which interval pattern based
* @param lrgDiffCalUnit the largest different calendar unit.
* @param intervalPattern the interval pattern on the largest different
* calendar unit.
* For example, if lrgDiffCalUnit is
* "year", the interval pattern for en_US when year
* is different could be "'from' yyyy 'to' yyyy".
* @throws IllegalArgumentException if setting interval pattern on
* a calendar field that is smaller
* than the MINIMUM_SUPPORTED_CALENDAR_FIELD
* @throws UnsupportedOperationException if the object is frozen
* @stable ICU 4.0
*/
public void setIntervalPattern(String skeleton,
int lrgDiffCalUnit,
String intervalPattern)
{
if ( frozen ) {
throw new UnsupportedOperationException("no modification is allowed after DII is frozen");
}
if ( lrgDiffCalUnit > MINIMUM_SUPPORTED_CALENDAR_FIELD ) {
throw new IllegalArgumentException("calendar field is larger than MINIMUM_SUPPORTED_CALENDAR_FIELD");
}
if (fIntervalPatternsReadOnly) {
fIntervalPatterns = cloneIntervalPatterns(fIntervalPatterns);
fIntervalPatternsReadOnly = false;
}
PatternInfo ptnInfo = setIntervalPatternInternally(skeleton,
CALENDAR_FIELD_TO_PATTERN_LETTER[lrgDiffCalUnit],
intervalPattern);
if ( lrgDiffCalUnit == Calendar.HOUR_OF_DAY ) {
setIntervalPattern(skeleton,
CALENDAR_FIELD_TO_PATTERN_LETTER[Calendar.AM_PM],
ptnInfo);
setIntervalPattern(skeleton,
CALENDAR_FIELD_TO_PATTERN_LETTER[Calendar.HOUR],
ptnInfo);
} else if ( lrgDiffCalUnit == Calendar.DAY_OF_MONTH ||
lrgDiffCalUnit == Calendar.DAY_OF_WEEK ) {
setIntervalPattern(skeleton,
CALENDAR_FIELD_TO_PATTERN_LETTER[Calendar.DATE],
ptnInfo);
}
}