当前位置: 首页>>代码示例>>Java>>正文


Java Calendar.roll方法代码示例

本文整理汇总了Java中com.ibm.icu.util.Calendar.roll方法的典型用法代码示例。如果您正苦于以下问题:Java Calendar.roll方法的具体用法?Java Calendar.roll怎么用?Java Calendar.roll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.ibm.icu.util.Calendar的用法示例。


在下文中一共展示了Calendar.roll方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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;
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:17,代码来源:ExpressionUiHelper.java

示例2: getDayNames

import com.ibm.icu.util.Calendar; //导入方法依赖的package包/类
/**
 * Returns a List of day name Strings - suitable for calendar headings.
 * @param locale
 * @return List of day name Strings
 */
public static List<String> getDayNames(Locale locale) {
    Calendar tempCal = Calendar.getInstance(locale);
    tempCal.set(Calendar.DAY_OF_WEEK, tempCal.getFirstDayOfWeek());
    SimpleDateFormat dateFormat = new SimpleDateFormat("EEEE", locale);
    List<String> resultList = new ArrayList<String>();
    for (int i = 0; i < 7; i++) {
        resultList.add(dateFormat.format(tempCal.getTime()));
        tempCal.roll(Calendar.DAY_OF_WEEK, 1);
    }
    return resultList;
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:17,代码来源:UtilDateTime.java

示例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;
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:18,代码来源:UtilDateTime.java

示例4: getDayValueList

import com.ibm.icu.util.Calendar; //导入方法依赖的package包/类
/** Returns a List of Maps containing day of the week 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>> getDayValueList(Locale locale) {
    Calendar tempCal = Calendar.getInstance(locale);
    tempCal.set(Calendar.DAY_OF_WEEK, tempCal.getFirstDayOfWeek());
    SimpleDateFormat dateFormat = new SimpleDateFormat("EEEE", locale);
    List<Map<String, Object>> result = new ArrayList<Map<String, Object>>(7);
    for (int i = 0; i < 7; i++) {
        result.add(UtilMisc.toMap("description", (Object)dateFormat.format(tempCal.getTime()), "value", tempCal.get(Calendar.DAY_OF_WEEK)));
        tempCal.roll(Calendar.DAY_OF_WEEK, 1);
    }
    return result;
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:17,代码来源:ExpressionUiHelper.java

示例5: getLastDayOfWeek

import com.ibm.icu.util.Calendar; //导入方法依赖的package包/类
/** Returns the last day of the week for the specified locale.
 * @param locale
 * @return The last day of the week for the specified locale
 */
public static int getLastDayOfWeek(Locale locale) {
    Calendar tempCal = Calendar.getInstance(locale);
    tempCal.set(Calendar.DAY_OF_WEEK, tempCal.getFirstDayOfWeek());
    tempCal.roll(Calendar.DAY_OF_WEEK, -1);
    return tempCal.get(Calendar.DAY_OF_WEEK);
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:11,代码来源:ExpressionUiHelper.java


注:本文中的com.ibm.icu.util.Calendar.roll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。