本文整理汇总了Java中java.util.GregorianCalendar.MONDAY属性的典型用法代码示例。如果您正苦于以下问题:Java GregorianCalendar.MONDAY属性的具体用法?Java GregorianCalendar.MONDAY怎么用?Java GregorianCalendar.MONDAY使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类java.util.GregorianCalendar
的用法示例。
在下文中一共展示了GregorianCalendar.MONDAY属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getWeekdayNum
private static int getWeekdayNum(Weekday weekday) {
switch (weekday) {
case SUNDAY:
return GregorianCalendar.SUNDAY;
case MONDAY:
return GregorianCalendar.MONDAY;
case TUESDAY:
return GregorianCalendar.TUESDAY;
case WEDNESDAY:
return GregorianCalendar.WEDNESDAY;
case THURSDAY:
return GregorianCalendar.THURSDAY;
case FRIDAY:
return GregorianCalendar.FRIDAY;
case SATURDAY:
return GregorianCalendar.SATURDAY;
default:
throw new IllegalArgumentException(L10nUtil.getMessage(MessageCodes.UNSUPPORTED_WEEKDAY, DefaultMessages.UNSUPPORTED_WEEKDAY, weekday));
}
}
示例2: getNameWeekDay
private String getNameWeekDay(Date date) {
final GregorianCalendar gc = new GregorianCalendar();
gc.setTime(date);
String s = "none";
//Monday Tuesday WEDNESDAY Thursday Friday Saturday Sunday
//понедельник вторник среда четверг пятница суббота воскресенье
switch (gc.get(GregorianCalendar.DAY_OF_WEEK)) {
case GregorianCalendar.MONDAY:
s = getLocaleMessage("calendar.day.monday");
break;
case GregorianCalendar.TUESDAY:
s = getLocaleMessage("calendar.day.tuesday");
break;
case GregorianCalendar.WEDNESDAY:
s = getLocaleMessage("calendar.day.wednesday");
break;
case GregorianCalendar.THURSDAY:
s = getLocaleMessage("calendar.day.thursday");
break;
case GregorianCalendar.FRIDAY:
s = getLocaleMessage("calendar.day.friday");
break;
case GregorianCalendar.SATURDAY:
s = getLocaleMessage("calendar.day.saturday");
break;
case GregorianCalendar.SUNDAY:
s = getLocaleMessage("calendar.day.sunday");
break;
}
return s;
}
示例3: getCalendarWeek
public static CalendarWeekVO getCalendarWeek(Date date) {
GregorianCalendar cal = new GregorianCalendar();
cal.setTime(date);
int year = cal.get(GregorianCalendar.YEAR);
int period;
switch ((new GregorianCalendar(year, 0, 1)).get(GregorianCalendar.DAY_OF_WEEK)) {
case GregorianCalendar.SUNDAY:
period = -1;
break;
case GregorianCalendar.MONDAY:
period = 0;
break;
case GregorianCalendar.TUESDAY:
period = 1;
break;
case GregorianCalendar.WEDNESDAY:
period = 2;
break;
case GregorianCalendar.THURSDAY:
period = 3;
break;
case GregorianCalendar.FRIDAY:
period = -3;
break;
case GregorianCalendar.SATURDAY:
period = -2;
break;
default:
period = 0;
}
int week = (int) ((cal.get(GregorianCalendar.DAY_OF_YEAR) - 1 + period) / 7d + 1);
if (week > getWeeksOfYear(year)) {
return new CalendarWeekVO(cal.getTime(), 1, year + 1);
} else if (week == 0) {
return new CalendarWeekVO(cal.getTime(), getWeeksOfYear(year - 1), year - 1);
} else {
return new CalendarWeekVO(cal.getTime(), week, year);
}
}