本文整理汇总了Java中com.ibm.icu.util.Calendar.JANUARY属性的典型用法代码示例。如果您正苦于以下问题:Java Calendar.JANUARY属性的具体用法?Java Calendar.JANUARY怎么用?Java Calendar.JANUARY使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.ibm.icu.util.Calendar
的用法示例。
在下文中一共展示了Calendar.JANUARY属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
@SuppressWarnings("unchecked")
@Override
public void visit(TemporalExpressions.MonthRange expr) {
int startMonth = expr.getStartMonth();
int endMonth = expr.getEndMonth();
Calendar cal = Calendar.getInstance();
int maxMonth = cal.getActualMaximum(Calendar.MONTH);
NumberList monthList = new NumberList();
monthList.add(startMonth + 1);
while (startMonth != endMonth) {
startMonth++;
if (startMonth > maxMonth) {
startMonth = Calendar.JANUARY;
}
monthList.add(startMonth + 1);
}
Recur recur = new Recur(Recur.MONTHLY, 0);
recur.getMonthList().addAll(monthList);
this.state.addRecur(recur);
}
示例2: getOffset
@Override
public int getOffset(int era, int year, int month, int day, int dayOfWeek, int milliseconds) {
if (month < Calendar.JANUARY || month > Calendar.DECEMBER) {
throw new IllegalArgumentException("Month is not in the legal range: " +month);
} else {
return getOffset(era, year, month, day, dayOfWeek, milliseconds, Grego.monthLength(year, month));
}
}
示例3: getMonthNames
/**
* Returns a List of month name Strings - suitable for calendar headings.
*
* @param locale
* @return List of month name Strings
*/
public static List<String> getMonthNames(Locale locale) {
Calendar tempCal = Calendar.getInstance(locale);
tempCal.set(Calendar.MONTH, Calendar.JANUARY);
SimpleDateFormat dateFormat = new SimpleDateFormat("MMMM", locale);
List<String> resultList = new ArrayList<String>();
for (int i = Calendar.JANUARY; i <= tempCal.getActualMaximum(Calendar.MONTH); i++) {
resultList.add(dateFormat.format(tempCal.getTime()));
tempCal.roll(Calendar.MONTH, 1);
}
return resultList;
}
示例4: MonthRange
/**
* @param start An integer in the range of <code>Calendar.JANUARY</code>
* to <code>Calendar.UNDECIMBER</code>
* @param end An integer in the range of <code>Calendar.JANUARY</code>
* to <code>Calendar.UNDECIMBER</code>
*/
public MonthRange(int start, int end) {
if (start < Calendar.JANUARY || start > Calendar.UNDECIMBER) {
throw new IllegalArgumentException("Invalid start argument");
}
if (end < Calendar.JANUARY || end > Calendar.UNDECIMBER) {
throw new IllegalArgumentException("Invalid end argument");
}
this.sequence = SEQUENCE_MONTH_RANGE + start;
this.start = start;
this.end = end;
if (Debug.verboseOn()) {
Debug.logVerbose("Created " + this, module);
}
}
示例5: getMonthValueList
/** Returns a List of Maps containing month values.
* @param locale
* @return List of Maps. Each Map has a
* <code>description</code> entry and a <code>value</code> entry.
*/
public static List<Map<String, Object>> getMonthValueList(Locale locale) {
Calendar tempCal = Calendar.getInstance(locale);
tempCal.set(Calendar.MONTH, Calendar.JANUARY);
SimpleDateFormat dateFormat = new SimpleDateFormat("MMMM", locale);
List<Map<String, Object>> result = new ArrayList<Map<String, Object>>(13);
for (int i = Calendar.JANUARY; i <= tempCal.getActualMaximum(Calendar.MONTH); i++) {
result.add(UtilMisc.toMap("description", (Object)dateFormat.format(tempCal.getTime()), "value", i));
tempCal.roll(Calendar.MONTH, 1);
}
return result;
}