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


Java Calendar.SUNDAY属性代码示例

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


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

示例1: getDay

private int getDay(int day) {
    switch (day) {
        case Calendar.SUNDAY:
            return 0;
        case Calendar.MONDAY:
            return 1;
        case Calendar.TUESDAY:
            return 2;
        case Calendar.WEDNESDAY:
            return 3;
        case Calendar.THURSDAY:
            return 4;
        case Calendar.FRIDAY:
            return 5;
        case Calendar.SATURDAY:
            return 6;
        default:
            return 0;
    }
}
 
开发者ID:riteshakya037,项目名称:Android-Scrapper,代码行数:20,代码来源:GridCalendarAdapter.java

示例2: getDays

public String getDays(String[] dayNames, String[] shortDyNames) {
    int nrDays = 0;
    int dayCode = 0;
    for (Meeting meeting : getMeetings()) {
        int dc = 0;
        switch (meeting.getDayOfWeek()) {
           case Calendar.MONDAY    : dc = Constants.DAY_CODES[Constants.DAY_MON]; break;
           case Calendar.TUESDAY   : dc = Constants.DAY_CODES[Constants.DAY_TUE]; break;
           case Calendar.WEDNESDAY : dc = Constants.DAY_CODES[Constants.DAY_WED]; break;
           case Calendar.THURSDAY  : dc = Constants.DAY_CODES[Constants.DAY_THU]; break;
           case Calendar.FRIDAY    : dc = Constants.DAY_CODES[Constants.DAY_FRI]; break;
           case Calendar.SATURDAY  : dc = Constants.DAY_CODES[Constants.DAY_SAT]; break;
           case Calendar.SUNDAY    : dc = Constants.DAY_CODES[Constants.DAY_SUN]; break;
        }
        if ((dayCode & dc)==0) nrDays++;
        dayCode |= dc;
    }
       String ret = "";
    for (int i=0;i<Constants.DAY_CODES.length;i++) {
        if ((dayCode & Constants.DAY_CODES[i])!=0)
            ret += (nrDays==1?dayNames:shortDyNames)[i];
    }
       return ret;
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:24,代码来源:Event.java

示例3: 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;
}
  }
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:22,代码来源:Constants.java

示例4: getTextView

/**
 * Get text view regarding a date
 * @param date date 
 * @return text view
 */
private int getTextView(Date date) {
    Calendar calendar = Calendar.getInstance();
    calendar.setTime(date);
    switch (calendar.get(Calendar.DAY_OF_WEEK)) {
        case Calendar.MONDAY:
            return R.id.monday_open_time;
        case Calendar.TUESDAY:
            return R.id.tuesday_open_time;
        case Calendar.WEDNESDAY:
            return R.id.wednesday_open_time;
        case Calendar.THURSDAY:
            return R.id.thursday_open_time;
        case Calendar.FRIDAY:
            return R.id.friday_open_time;
        case Calendar.SATURDAY:
            return R.id.saturday_open_time;
        case Calendar.SUNDAY:
            return R.id.sunday_open_time;
    }
    return 0;
}
 
开发者ID:Wisebite,项目名称:wisebite_android,代码行数:26,代码来源:GetRestaurantActivity.java

示例5: getDayOfWeek

/**
 * 描述:获取本周的某一天.
 *
 * @param format        the format
 * @param calendarField the calendar field
 * @return String String类型日期时间
 */
private static String getDayOfWeek(String format, int calendarField) {
    String strDate = null;
    try {
        Calendar c = new GregorianCalendar();
        SimpleDateFormat mSimpleDateFormat = new SimpleDateFormat(format);
        int week = c.get(Calendar.DAY_OF_WEEK);
        if (week == calendarField) {
            strDate = mSimpleDateFormat.format(c.getTime());
        } else {
            int offectDay = calendarField - week;
            if (calendarField == Calendar.SUNDAY) {
                offectDay = 7 - Math.abs(offectDay);
            }
            c.add(Calendar.DATE, offectDay);
            strDate = mSimpleDateFormat.format(c.getTime());
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return strDate;
}
 
开发者ID:wp521,项目名称:MyFire,代码行数:28,代码来源:TimeUtil.java

示例6: parseViewIdToDayOfWeek

public static int parseViewIdToDayOfWeek(Integer viewId) {
    switch (viewId) {
        case R.id.monday_date_picker:
            return Calendar.MONDAY;
        case R.id.tuesday_date_picker:
            return Calendar.TUESDAY;
        case R.id.wednesday_date_picker:
            return Calendar.WEDNESDAY;
        case R.id.thursday_date_picker:
            return Calendar.THURSDAY;
        case R.id.friday_date_picker:
            return Calendar.FRIDAY;
        case R.id.saturday_date_picker:
            return Calendar.SATURDAY;
        case R.id.sunday_date_picker:
            return Calendar.SUNDAY;
        default:
            return 0;
    }
}
 
开发者ID:Wisebite,项目名称:wisebite_android,代码行数:20,代码来源:Utils.java

示例7: checkWorkday

@Override
protected boolean checkWorkday(Calendar cal) {
    Calendar dayBefore = new GregorianCalendar(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DATE));
    dayBefore.add(Calendar.DATE, -1);

    Calendar dayAfter = new GregorianCalendar(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DATE));
    dayAfter.add(Calendar.DATE, 1);

    // if day before cal is a holiday and the day after cal is saturday
    // then cal is a bridge day (means: no work day)
    if(this.holidayProvider.isHoliday(dayBefore) && dayAfter.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY) {
        return false;
    }

    // if day before cal is a sunday and the day after cal is a holiday
    // then cal is a bridge day (means: no work day)
    if(dayBefore.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY && this.holidayProvider.isHoliday(dayAfter)) {
        return false;
    }

    return true;
}
 
开发者ID:ste-bo,项目名称:workdays,代码行数:22,代码来源:BridgeDayFilter.java

示例8: toWeekDay

private static int toWeekDay(int calWeekDay) {
    if (calWeekDay == Calendar.SUNDAY) {
        return 7;
    } else {
        return calWeekDay - 1;
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:7,代码来源:DateTimeTextProvider.java

示例9: getWeekDay

/**
 * 根据日期,返回其星期数,周一为1,周日为7
 * @param date
 * @return
 */
public static int getWeekDay(Date date) {
	Calendar calendar = Calendar.getInstance();
	calendar.setTime(date);
	int w = calendar.get(Calendar.DAY_OF_WEEK);
	int ret;
	if (w == Calendar.SUNDAY)
		ret = 7;
	else
		ret = w - 1;
	return ret;
}
 
开发者ID:jmdhappy,项目名称:xxpay-master,代码行数:16,代码来源:DateUtil.java

示例10: WeekLesson

/**
 * Full params constructor
 */
public WeekLesson(int week_lesson_id, @Nonnull String subject_id, int repeat_id, @Nonnegative int week_lesson_day_start,
                  @Nonnegative int week_lesson_day_end, @Nonnegative int week_lesson_day_index) {
    if (week_lesson_id > 0) {
        this.week_lesson_id = week_lesson_id;
    } else {
        this.week_lesson_id = Constant.INT_NONE_VALUE;
    }
    this.subject_id = subject_id;
    if (repeat_id > 0) {
        this.repeat_id = repeat_id;
    } else {
        this.repeat_id = Constant.INT_NONE_VALUE;
    }
    if (week_lesson_day_start >= 0) {
        this.week_lesson_day_start = week_lesson_day_start;
    }else {
        this.week_lesson_day_start = 0;
    }
    if (!(week_lesson_day_end >= this.week_lesson_day_start)) {
        this.week_lesson_day_end = week_lesson_day_end;
    }else {
        this.week_lesson_day_end = this.week_lesson_day_start;
    }
    if (week_lesson_day_index >= Calendar.SUNDAY && week_lesson_day_index <= Calendar.SATURDAY) {
        this.week_lesson_day_index = week_lesson_day_index;
    }
}
 
开发者ID:nhocga1995s,项目名称:MyCalendar,代码行数:30,代码来源:WeekLesson.java

示例11: exactTime256WithUpdateReason

static byte[] exactTime256WithUpdateReason(Calendar time, byte updateReason) {
    // See https://www.bluetooth.com/specifications/gatt/viewer?attributeXmlFile=org.bluetooth.characteristic.current_time.xml

    // Calendar: January = 0
    // CTS: January = 1
    int month = time.get(Calendar.MONTH) + 1;

    // Calendar: Monday = 2, Sunday = 1
    // CTS: Monday = 1, Sunday = 7
    int dayOfWeek = time.get(Calendar.DAY_OF_WEEK);
    if (dayOfWeek == Calendar.SUNDAY) {
        dayOfWeek = 7;
    } else {
        dayOfWeek = dayOfWeek - 1;
    }

    // 256ths of a second
    int fractionsOfSecond = (int)((time).get(Calendar.MILLISECOND) * 0.255F);

    return ByteBuffer.allocate(10)
            .order(ByteOrder.LITTLE_ENDIAN)
            .putShort((short) time.get(Calendar.YEAR))
            .put((byte) month)
            .put((byte) time.get(Calendar.DAY_OF_MONTH))
            .put((byte) time.get(Calendar.HOUR_OF_DAY))
            .put((byte) time.get(Calendar.MINUTE))
            .put((byte) time.get(Calendar.SECOND))
            .put((byte) dayOfWeek)
            .put((byte) fractionsOfSecond)
            .put(updateReason)
            .array();
}
 
开发者ID:RideBeeline,项目名称:android-bluetooth-current-time-service,代码行数:32,代码来源:TimeData.java

示例12: setFirstDayOfWeek

public void setFirstDayOfWeek(int startOfWeek) {
    if (startOfWeek < Calendar.SUNDAY || startOfWeek > Calendar.SATURDAY) {
        throw new IllegalArgumentException(
                "Value must be between Calendar.SUNDAY and "
                        + "Calendar.SATURDAY");
    }
    mWeekStart = startOfWeek;
    if (mDayPickerView != null) {
        mDayPickerView.onChange();
    }
}
 
开发者ID:hsj-xiaokang,项目名称:OSchina_resources_android,代码行数:11,代码来源:DatePickerDialog.java

示例13: 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;       		
}
 
开发者ID:ser316asu,项目名称:SER316-Dresden,代码行数:37,代码来源:EventsTableMonthly.java

示例14: checkCurrentTime

private void checkCurrentTime() {
    Calendar now = Calendar.getInstance();

    int second = now.get(Calendar.SECOND);
    int minute = now.get(Calendar.MINUTE);
    int hour = now.get(Calendar.HOUR_OF_DAY);
    int weekday = now.get(Calendar.DAY_OF_WEEK);

    boolean isWeekend = weekday == Calendar.SUNDAY || weekday == Calendar.SATURDAY;

    _logger.Debug(String.format(Locale.GERMAN,
            "checkCurrentTime at %02d:%02d:%02d on %d",
            hour, minute, second, weekday));

    if ((second >= 0 && second < 5) && minute == 0) {
        for (AutomaticSettings entry : AutomaticSettings.values()) {
            if (entry.GetEnableHour() == hour) {
                if ((entry.IsWeekend() && isWeekend) || (!entry.IsWeekend() && !isWeekend)) {
                    int maxVolume = _mediaVolumeController.GetMaxVolume();
                    double currentVolume = (entry.GetSoundVolumePercentage() / 100) * maxVolume;
                    setSettings(currentVolume, (int) entry.GetScreenBrightnessPercentage());
                    break;
                }
            }
        }
    }
}
 
开发者ID:GuepardoApps,项目名称:LucaHome-MediaServer,代码行数:27,代码来源:MainService.java

示例15: RepeatPreference

public RepeatPreference(Context context, AttributeSet attrs) {
  super(context, attrs);

  String[] weekdays = new DateFormatSymbols().getWeekdays();
  String[] values = new String[]{
      weekdays[Calendar.MONDAY],
      weekdays[Calendar.TUESDAY],
      weekdays[Calendar.WEDNESDAY],
      weekdays[Calendar.THURSDAY],
      weekdays[Calendar.FRIDAY],
      weekdays[Calendar.SATURDAY],
      weekdays[Calendar.SUNDAY],};
  setEntries(values);
  setEntryValues(values);
}
 
开发者ID:nordfalk,项目名称:EsperantoRadio,代码行数:15,代码来源:RepeatPreference.java


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