本文整理汇总了Java中java.util.Calendar.WEDNESDAY属性的典型用法代码示例。如果您正苦于以下问题:Java Calendar.WEDNESDAY属性的具体用法?Java Calendar.WEDNESDAY怎么用?Java Calendar.WEDNESDAY使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类java.util.Calendar
的用法示例。
在下文中一共展示了Calendar.WEDNESDAY属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getWeek
public static String getWeek(Calendar calendar) {
String[] week = AmenEyeApplication.getContext().getResources().getStringArray(R.array.week_array);
int day = calendar.get(Calendar.DAY_OF_WEEK);
switch (day) {
case Calendar.MONDAY:
return week[0];
case Calendar.TUESDAY:
return week[1];
case Calendar.WEDNESDAY:
return week[2];
case Calendar.THURSDAY:
return week[3];
case Calendar.FRIDAY:
return week[4];
case Calendar.SATURDAY:
return week[5];
case Calendar.SUNDAY:
return week[6];
default:
return null;
}
}
示例2: getDayOfWeek
public static int getDayOfWeek(Date date) {
Calendar c = Calendar.getInstance(Locale.US);
c.setTime(date);
switch (c.get(Calendar.DAY_OF_WEEK)) {
case Calendar.MONDAY:
return DAY_MON;
case Calendar.TUESDAY:
return DAY_TUE;
case Calendar.WEDNESDAY:
return DAY_WED;
case Calendar.THURSDAY:
return DAY_THU;
case Calendar.FRIDAY:
return DAY_FRI;
case Calendar.SATURDAY:
return DAY_SAT;
case Calendar.SUNDAY:
return DAY_SUN;
default:
return DAY_MON;
}
}
示例3: getDaysCode
public int getDaysCode(Event event) {
int daysCode = 0;
for (Iterator i=event.getMeetings().iterator();i.hasNext();) {
Meeting meeting = (Meeting)i.next();
Calendar date = Calendar.getInstance(Locale.US);
date.setTime(meeting.getMeetingDate());
switch (date.get(Calendar.DAY_OF_WEEK)) {
case Calendar.MONDAY : daysCode |= Constants.DAY_CODES[Constants.DAY_MON]; break;
case Calendar.TUESDAY : daysCode |= Constants.DAY_CODES[Constants.DAY_TUE]; break;
case Calendar.WEDNESDAY : daysCode |= Constants.DAY_CODES[Constants.DAY_WED]; break;
case Calendar.THURSDAY : daysCode |= Constants.DAY_CODES[Constants.DAY_THU]; break;
case Calendar.FRIDAY : daysCode |= Constants.DAY_CODES[Constants.DAY_FRI]; break;
case Calendar.SATURDAY : daysCode |= Constants.DAY_CODES[Constants.DAY_SAT]; break;
case Calendar.SUNDAY : daysCode |= Constants.DAY_CODES[Constants.DAY_SUN]; break;
}
}
return daysCode;
}
示例4: dayIsRepeat
private static boolean dayIsRepeat(int calendarDow, int repeat) {
switch (calendarDow) {
case Calendar.SUNDAY:
return (1 & repeat) != 0;
case Calendar.MONDAY:
return (2 & repeat) != 0;
case Calendar.TUESDAY:
return (4 & repeat) != 0;
case Calendar.WEDNESDAY:
return (8 & repeat) != 0;
case Calendar.THURSDAY:
return (16 & repeat) != 0;
case Calendar.FRIDAY:
return (32 & repeat) != 0;
case Calendar.SATURDAY:
return (64 & repeat) != 0;
}
return true;
}
示例5: setDay
public void setDay(int calendarDay, boolean active) {
switch (calendarDay) {
case Calendar.MONDAY:
value.set(0, active);
break;
case Calendar.TUESDAY:
value.set(1, active);
break;
case Calendar.WEDNESDAY:
value.set(2, active);
break;
case Calendar.THURSDAY:
value.set(3, active);
break;
case Calendar.FRIDAY:
value.set(4, active);
break;
case Calendar.SATURDAY:
value.set(5, active);
break;
case Calendar.SUNDAY:
value.set(6, active);
break;
}
}
示例6: getDayOfWeek
public static DataClass getDayOfWeek(LinkedList<DataClass> listParams) throws JFCALCExpErrException {
if (listParams.size() != 1) {
throw new JFCALCExpErrException(ERRORTYPES.ERROR_INCORRECT_NUM_OF_PARAMETER);
}
DataClass datumTS = new DataClass();
datumTS.copyTypeValueDeep(listParams.removeLast());
datumTS.changeDataType(DATATYPES.DATUM_INTEGER);
long lTS = datumTS.getDataValue().longValue();
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(lTS);
int nReturn = cal.get(Calendar.DAY_OF_WEEK);
int nDayOfWeek = 0;
switch (nReturn) {
case (Calendar.SUNDAY): {
nDayOfWeek = 0;
break;
} case (Calendar.MONDAY): {
nDayOfWeek = 1;
break;
} case (Calendar.TUESDAY): {
nDayOfWeek = 2;
break;
} case (Calendar.WEDNESDAY): {
nDayOfWeek = 3;
break;
} case (Calendar.THURSDAY): {
nDayOfWeek = 4;
break;
} case (Calendar.FRIDAY): {
nDayOfWeek = 5;
break;
} case (Calendar.SATURDAY): {
nDayOfWeek = 6;
break;
}
}
return new DataClass(DATATYPES.DATUM_INTEGER, new MFPNumeric(nDayOfWeek));
}
示例7: getValueAt
public Object getValueAt(int row, int col) {
Event ev = getEventAt(row,col);
if(ev == null) return "";
Calendar cal = (Calendar)days[col].get(row);
String res = "";
switch(cal.get(Calendar.DAY_OF_WEEK)){
case Calendar.SUNDAY: res += "SU";
break;
case Calendar.MONDAY: res += "MO";
break;
case Calendar.TUESDAY: res += "TU";
break;
case Calendar.WEDNESDAY: res += "WE";
break;
case Calendar.THURSDAY: res += "TH";
break;
case Calendar.FRIDAY: res += "FR";
break;
case Calendar.SATURDAY: res += "SA";
break;
default: res += "??";
}
String dOM = cal.get(Calendar.DAY_OF_MONTH) + "";
switch(cal.get(Calendar.DAY_OF_MONTH)%10){
case 1: dOM += "st";
break;
case 2: dOM += "nd";
break;
case 3: dOM += "rd";
break;
default:dOM+="th";
}
res+= " / " + dOM + ": ";
if(ev.getText().equals("")) res+= "EVENT";
else res += ev.getText();
return res;
}
示例8: createCurrentTimeValue
private static byte[] createCurrentTimeValue() {
byte[] arrayOfByte = new byte[10];
Calendar localCalendar = Calendar.getInstance();
int i = localCalendar.get(1);
arrayOfByte[0] = (byte) (0xFF & i >>> 0);
arrayOfByte[1] = (byte) (0xFF & i >>> 8);
arrayOfByte[2] = (byte) (1 + localCalendar.get(2));
arrayOfByte[3] = (byte) localCalendar.get(5);
arrayOfByte[4] = (byte) localCalendar.get(11);
arrayOfByte[5] = (byte) localCalendar.get(12);
arrayOfByte[6] = (byte) (localCalendar.get(13) + 1);
switch (localCalendar.get(7)) {
case Calendar.MONDAY:
arrayOfByte[7] = 0x01;
break;
case Calendar.TUESDAY:
arrayOfByte[7] = 0x02;
break;
case Calendar.WEDNESDAY:
arrayOfByte[7] = 0x03;
break;
case Calendar.THURSDAY:
arrayOfByte[7] = 0x04;
break;
case Calendar.FRIDAY:
arrayOfByte[7] = 0x05;
break;
case Calendar.SATURDAY:
arrayOfByte[7] = 0x06;
break;
case Calendar.SUNDAY:
arrayOfByte[7] = 0x07;
break;
}
arrayOfByte[8] = (byte) (int) TimeUnit.MILLISECONDS.toSeconds(256 * localCalendar.get(14));
arrayOfByte[9] = 0;
return arrayOfByte;
}
示例9: getDay
public boolean getDay(int calendarDay) {
switch (calendarDay) {
case Calendar.MONDAY:
return value.get(0);
case Calendar.TUESDAY:
return value.get(1);
case Calendar.WEDNESDAY:
return value.get(2);
case Calendar.THURSDAY:
return value.get(3);
case Calendar.FRIDAY:
return value.get(4);
case Calendar.SATURDAY:
return value.get(5);
case Calendar.SUNDAY:
return value.get(6);
default:
throw new InvalidParameterException("Invalid parameter. Must be a Calendar.DAY_OF_WEEK. Given value=" + calendarDay);
}
}
示例10: setCurrentClock
void setCurrentClock() {
ChipRobot robot = ChipRobotFinder.getInstance().getChipRobotConnectedList().get(0);
Calendar rightNow = Calendar.getInstance();
final int year = rightNow.get(Calendar.YEAR);
final int month = rightNow.get(Calendar.MONTH);
final int day = rightNow.get(Calendar.DATE);
final int hour = rightNow.get(Calendar.HOUR_OF_DAY);
final int minute = rightNow.get(Calendar.MINUTE);
final int seconds = rightNow.get(Calendar.SECOND);
int dayOfWeek_t = rightNow.get(Calendar.DAY_OF_WEEK);
switch (dayOfWeek_t) {
case Calendar.SUNDAY:
dayOfWeek_t = 0;
break;
case Calendar.MONDAY:
dayOfWeek_t = 1;
break;
case Calendar.TUESDAY:
dayOfWeek_t = 2;
break;
case Calendar.WEDNESDAY:
dayOfWeek_t = 3;
break;
case Calendar.THURSDAY:
dayOfWeek_t = 4;
break;
case Calendar.FRIDAY:
dayOfWeek_t = 5;
break;
case Calendar.SATURDAY:
break;
}
final int dayOfWeek = dayOfWeek_t;
robot.chipSetCurrentClock(year, (byte) (month + 1), (byte) day, (byte) hour, (byte) minute, (byte) seconds, (byte) dayOfWeek);
}
示例11: setToday
private void setToday() {
Calendar calendar = Calendar.getInstance();
int date = calendar.get(Calendar.DAY_OF_WEEK);
switch (date) {
case Calendar.MONDAY:
dayMonday.setSelected(true);
break;
case Calendar.TUESDAY:
dayTuesday.setSelected(true);
break;
case Calendar.WEDNESDAY:
dayWednesday.setSelected(true);
break;
case Calendar.THURSDAY:
dayThursday.setSelected(true);
break;
case Calendar.FRIDAY:
dayFriday.setSelected(true);
break;
case Calendar.SATURDAY:
daySaturday.setSelected(true);
break;
case Calendar.SUNDAY:
daySunday.setSelected(true);
break;
}
}
示例12: firstDate
protected static Date firstDate(DatePattern dp, int dayCode) {
if (dp == null) return null;
BitSet weekCode = dp.getPatternBitSet();
if (weekCode.isEmpty()) return null;
Calendar cal = Calendar.getInstance(Locale.US); cal.setLenient(true);
Date dpFirstDate = DateUtils.getDate(1, dp.getSession().getPatternStartMonth(), dp.getSession().getSessionStartYear());
cal.setTime(dpFirstDate);
int idx = weekCode.nextSetBit(0);
cal.add(Calendar.DAY_OF_YEAR, idx);
while (idx < weekCode.size()) {
if (weekCode.get(idx)) {
int dow = cal.get(Calendar.DAY_OF_WEEK);
switch (dow) {
case Calendar.MONDAY:
if ((dayCode & DayCode.MON.getCode()) != 0) return cal.getTime();
break;
case Calendar.TUESDAY:
if ((dayCode & DayCode.TUE.getCode()) != 0) return cal.getTime();
break;
case Calendar.WEDNESDAY:
if ((dayCode & DayCode.WED.getCode()) != 0) return cal.getTime();
break;
case Calendar.THURSDAY:
if ((dayCode & DayCode.THU.getCode()) != 0) return cal.getTime();
break;
case Calendar.FRIDAY:
if ((dayCode & DayCode.FRI.getCode()) != 0) return cal.getTime();
break;
case Calendar.SATURDAY:
if ((dayCode & DayCode.SAT.getCode()) != 0) return cal.getTime();
break;
case Calendar.SUNDAY:
if ((dayCode & DayCode.SUN.getCode()) != 0) return cal.getTime();
break;
}
}
cal.add(Calendar.DAY_OF_YEAR, 1); idx++;
}
return null;
}
示例13: generateUnavailabilityMeetings
public static TreeSet<MeetingInterface> generateUnavailabilityMeetings(Location location, boolean conflict) {
if (location.getEventAvailability() == null || location.getEventAvailability().length() != Constants.SLOTS_PER_DAY * Constants.DAY_CODES.length) return null;
TreeSet<MeetingInterface> ret = new TreeSet<MeetingInterface>();
ResourceInterface resource = new ResourceInterface();
resource.setType(ResourceType.ROOM);
resource.setId(location.getUniqueId());
resource.setName(location.getLabel());
resource.setSize(location.getCapacity());
resource.setRoomType(location.getRoomTypeLabel());
resource.setBreakTime(location.getEffectiveBreakTime());
resource.setMessage(location.getEventMessage());
resource.setIgnoreRoomCheck(location.isIgnoreRoomCheck());
resource.setDisplayName(location.getDisplayName());
Calendar calendar = Calendar.getInstance();
for (int day = 0; day < Constants.DAY_CODES.length; day++)
for (int startTime = 0; startTime < Constants.SLOTS_PER_DAY; ) {
if (location.getEventAvailability().charAt(day * Constants.SLOTS_PER_DAY + startTime) != '1') { startTime++; continue; }
int endTime = startTime + 1;
while (endTime < Constants.SLOTS_PER_DAY && location.getEventAvailability().charAt(day * Constants.SLOTS_PER_DAY + endTime) == '1') endTime++;
calendar.setTime(location.getSession().getEventBeginDate());
int dayOfYear = CalendarUtils.date2dayOfYear(location.getSession().getSessionStartYear(), calendar.getTime());
do {
int dayOfWeek = -1;
switch (calendar.get(Calendar.DAY_OF_WEEK)) {
case Calendar.MONDAY: dayOfWeek = Constants.DAY_MON; break;
case Calendar.TUESDAY: dayOfWeek = Constants.DAY_TUE; break;
case Calendar.WEDNESDAY: dayOfWeek = Constants.DAY_WED; break;
case Calendar.THURSDAY: dayOfWeek = Constants.DAY_THU; break;
case Calendar.FRIDAY: dayOfWeek = Constants.DAY_FRI; break;
case Calendar.SATURDAY: dayOfWeek = Constants.DAY_SAT; break;
case Calendar.SUNDAY: dayOfWeek = Constants.DAY_SUN; break;
}
if (day == dayOfWeek) {
MeetingInterface m = null;
if (conflict) {
MeetingConflictInterface c = new MeetingConflictInterface();
c.setName(MESSAGES.unavailableEventDefaultName());
c.setType(EventInterface.EventType.Unavailabile);
m = c;
} else {
m = new MeetingInterface();
}
m.setStartSlot(startTime);
m.setEndSlot(endTime);
m.setDayOfWeek(dayOfWeek);
m.setMeetingDate(calendar.getTime());
m.setDayOfYear(dayOfYear);
m.setLocation(resource);
ret.add(m);
}
calendar.add(Calendar.DAY_OF_YEAR, 1); dayOfYear++;
} while (!calendar.getTime().after(location.getSession().getEventEndDate()));
startTime = endTime;
}
return ret;
}
示例14: printDayOfWeek
/**
* 获得今天是周几
*/
private void printDayOfWeek() {
// 获取今天是周几,和常量SUNDAY,MONDAY,TUESDAY,WEDNESDAY,THURSDAY,FRIDAY,SATURDAY搭配使用
// 不要用获得的返回值来直接判断周几,例如,返回值为3不代表今天是周三,返回值为3其实是周二
switch (c.get(Calendar.DAY_OF_WEEK)) {
case Calendar.SUNDAY:
Log.i("MainActivityFilter", "今天是周日");
break;
case Calendar.MONDAY:
Log.i("MainActivityFilter", "今天是周一");
break;
case Calendar.TUESDAY:
Log.i("MainActivityFilter", "今天是周二");
break;
case Calendar.WEDNESDAY:
Log.i("MainActivityFilter", "今天是周三");
break;
case Calendar.THURSDAY:
Log.i("MainActivityFilter", "今天是周四");
break;
case Calendar.FRIDAY:
Log.i("MainActivityFilter", "今天是周五");
break;
case Calendar.SATURDAY:
Log.i("MainActivityFilter", "今天是周六");
break;
default:
break;
}
}
示例15: generateUnavailabilityMeetings
public static TreeSet<MeetingConflictInterface> generateUnavailabilityMeetings(Location location, List<Integer> dates, int startSlot, int endSlot) {
if (location.getEventAvailability() == null || location.getEventAvailability().length() != Constants.SLOTS_PER_DAY * Constants.DAY_CODES.length) return null;
TreeSet<MeetingConflictInterface> ret = new TreeSet<MeetingConflictInterface>();
ResourceInterface resource = new ResourceInterface();
resource.setType(ResourceType.ROOM);
resource.setId(location.getUniqueId());
resource.setName(location.getLabel());
resource.setSize(location.getCapacity());
resource.setRoomType(location.getRoomTypeLabel());
resource.setBreakTime(location.getEffectiveBreakTime());
resource.setMessage(location.getEventMessage());
resource.setIgnoreRoomCheck(location.isIgnoreRoomCheck());
resource.setDisplayName(location.getDisplayName());
Calendar calendar = Calendar.getInstance();
for (int day = 0; day < Constants.DAY_CODES.length; day++)
for (int startTime = 0; startTime < Constants.SLOTS_PER_DAY; ) {
if (location.getEventAvailability().charAt(day * Constants.SLOTS_PER_DAY + startTime) != '1') { startTime++; continue; }
int endTime = startTime + 1;
while (endTime < Constants.SLOTS_PER_DAY && location.getEventAvailability().charAt(day * Constants.SLOTS_PER_DAY + endTime) == '1') endTime++;
if (startTime < endSlot && startSlot < endTime) {
calendar.setTime(location.getSession().getEventBeginDate());
int dayOfYear = CalendarUtils.date2dayOfYear(location.getSession().getSessionStartYear(), calendar.getTime());
do {
if (dates.contains(dayOfYear)) {
int dayOfWeek = -1;
switch (calendar.get(Calendar.DAY_OF_WEEK)) {
case Calendar.MONDAY: dayOfWeek = Constants.DAY_MON; break;
case Calendar.TUESDAY: dayOfWeek = Constants.DAY_TUE; break;
case Calendar.WEDNESDAY: dayOfWeek = Constants.DAY_WED; break;
case Calendar.THURSDAY: dayOfWeek = Constants.DAY_THU; break;
case Calendar.FRIDAY: dayOfWeek = Constants.DAY_FRI; break;
case Calendar.SATURDAY: dayOfWeek = Constants.DAY_SAT; break;
case Calendar.SUNDAY: dayOfWeek = Constants.DAY_SUN; break;
}
if (day == dayOfWeek) {
MeetingConflictInterface m = new MeetingConflictInterface();
m.setName(MESSAGES.unavailableEventDefaultName());
m.setType(EventInterface.EventType.Unavailabile);
m.setStartSlot(startTime);
m.setEndSlot(endTime);
m.setDayOfWeek(dayOfWeek);
m.setMeetingDate(calendar.getTime());
m.setDayOfYear(dayOfYear);
m.setLocation(resource);
ret.add(m);
}
}
calendar.add(Calendar.DAY_OF_YEAR, 1); dayOfYear++;
} while (!calendar.getTime().after(location.getSession().getEventEndDate()));
}
startTime = endTime;
}
return ret;
}