本文整理汇总了Java中com.ibm.icu.util.Calendar.MONTH属性的典型用法代码示例。如果您正苦于以下问题:Java Calendar.MONTH属性的具体用法?Java Calendar.MONTH怎么用?Java Calendar.MONTH使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.ibm.icu.util.Calendar
的用法示例。
在下文中一共展示了Calendar.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: getPatterns
/**
* @internal
* @deprecated This API is ICU internal only.
*/
@Deprecated
public String getPatterns(Calendar fromCalendar,
Calendar toCalendar,
Output<String> part2) {
// First, find the largest different calendar field.
int field;
if ( fromCalendar.get(Calendar.ERA) != toCalendar.get(Calendar.ERA) ) {
field = Calendar.ERA;
} else if ( fromCalendar.get(Calendar.YEAR) !=
toCalendar.get(Calendar.YEAR) ) {
field = Calendar.YEAR;
} else if ( fromCalendar.get(Calendar.MONTH) !=
toCalendar.get(Calendar.MONTH) ) {
field = Calendar.MONTH;
} else if ( fromCalendar.get(Calendar.DATE) !=
toCalendar.get(Calendar.DATE) ) {
field = Calendar.DATE;
} else if ( fromCalendar.get(Calendar.AM_PM) !=
toCalendar.get(Calendar.AM_PM) ) {
field = Calendar.AM_PM;
} else if ( fromCalendar.get(Calendar.HOUR) !=
toCalendar.get(Calendar.HOUR) ) {
field = Calendar.HOUR;
} else if ( fromCalendar.get(Calendar.MINUTE) !=
toCalendar.get(Calendar.MINUTE) ) {
field = Calendar.MINUTE;
} else if ( fromCalendar.get(Calendar.SECOND) !=
toCalendar.get(Calendar.SECOND) ) {
field = Calendar.SECOND;
} else {
return null;
}
PatternInfo intervalPattern = fIntervalPatterns.get(
DateIntervalInfo.CALENDAR_FIELD_TO_PATTERN_LETTER[field]);
part2.value = intervalPattern.getSecondPart();
return intervalPattern.getFirstPart();
}
示例3: 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;
}
}
示例4: uomTimeToCalTime
public static int[] uomTimeToCalTime(String uomId) {
if ("TF_ms".equals(uomId)) {
return new int[] { Calendar.MILLISECOND, 1 };
} else if ("TF_s".equals(uomId)) {
return new int[] { Calendar.SECOND, 1 };
} else if ("TF_min".equals(uomId)) {
return new int[] { Calendar.MINUTE, 1 };
} else if ("TF_hr".equals(uomId)) {
return new int[] { Calendar.HOUR, 1 };
} else if ("TF_day".equals(uomId)) {
return new int[] { Calendar.DAY_OF_YEAR, 1 };
} else if ("TF_wk".equals(uomId)) {
return new int[] { Calendar.WEEK_OF_YEAR, 1 };
} else if ("TF_mon".equals(uomId)) {
return new int[] { Calendar.MONTH, 1 };
} else if ("TF_yr".equals(uomId)) {
return new int[] { Calendar.YEAR, 1 };
} else if ("TF_decade".equals(uomId)) {
return new int[] { Calendar.YEAR, 10 };
} else if ("TF_score".equals(uomId)) {
return new int[] { Calendar.YEAR, 20 };
} else if ("TF_century".equals(uomId)) {
return new int[] { Calendar.YEAR, 100 };
} else if ("TF_millenium".equals(uomId)) {
return new int[] { Calendar.YEAR, 1000 };
}
return null;
}