本文整理汇总了Java中com.ibm.icu.util.Calendar.getActualMaximum方法的典型用法代码示例。如果您正苦于以下问题:Java Calendar.getActualMaximum方法的具体用法?Java Calendar.getActualMaximum怎么用?Java Calendar.getActualMaximum使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.ibm.icu.util.Calendar
的用法示例。
在下文中一共展示了Calendar.getActualMaximum方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import com.ibm.icu.util.Calendar; //导入方法依赖的package包/类
@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: adjustDayInMonthIfNeeded
import com.ibm.icu.util.Calendar; //导入方法依赖的package包/类
private void adjustDayInMonthIfNeeded(Calendar calendar) {
int day = calendar.get(Calendar.DAY_OF_MONTH);
int daysInMonth = calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
if (day > daysInMonth) {
calendar.set(Calendar.DAY_OF_MONTH, daysInMonth);
}
setToNearestDate(calendar);
}
示例3: getMonthNames
import com.ibm.icu.util.Calendar; //导入方法依赖的package包/类
/**
* 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: getMonthValueList
import com.ibm.icu.util.Calendar; //导入方法依赖的package包/类
/** 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;
}