本文整理汇总了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;
}
示例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;
}
示例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: 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;
}
示例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);
}