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


Java Calendar.SUNDAY属性代码示例

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


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

示例1: format

/**
 * Formats a relative date without a quantity.
 * @param direction NEXT, LAST, THIS, etc.
 * @param unit e.g SATURDAY, DAY, MONTH
 * @return the formatted string. If direction has a value that is documented as not being
 *  fully supported in every locale (for example NEXT_2 or LAST_2) then this function may
 *  return null to signal that no formatted string is available.
 * @throws IllegalArgumentException if the direction is incompatible with
 * unit this can occur with NOW which can only take PLAIN.
 * @stable ICU 53
 */
public String format(Direction direction, AbsoluteUnit unit) {
    if (unit == AbsoluteUnit.NOW && direction != Direction.PLAIN) {
        throw new IllegalArgumentException("NOW can only accept direction PLAIN.");
    }
    String result;
    // Get plain day of week names from DateFormatSymbols.
    if ((direction == Direction.PLAIN) &&  (AbsoluteUnit.SUNDAY.ordinal() <= unit.ordinal() &&
            unit.ordinal() <= AbsoluteUnit.SATURDAY.ordinal())) {
        // Convert from AbsoluteUnit days to Calendar class indexing.
        int dateSymbolsDayOrdinal = (unit.ordinal() - AbsoluteUnit.SUNDAY.ordinal()) + Calendar.SUNDAY;
        String[] dayNames =
                dateFormatSymbols.getWeekdays(DateFormatSymbols.STANDALONE,
                styleToDateFormatSymbolsWidth[style.ordinal()]);
        result = dayNames[dateSymbolsDayOrdinal];
    } else {
        // Not PLAIN, or not a weekday.
        result = getAbsoluteUnitString(style, unit, direction);
    }
    return result != null ? adjustForContext(result) : null;
}
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:31,代码来源:RelativeDateTimeFormatter.java

示例2: visit

@SuppressWarnings("unchecked")
@Override
public void visit(TemporalExpressions.DayOfWeekRange expr) {
    int startDay = expr.getStartDay();
    int endDay = expr.getEndDay();
    WeekDayList dayList = new WeekDayList();
    dayList.add(dayOfWeekArray[startDay - 1]);
    while (startDay != endDay) {
        startDay++;
        if (startDay > Calendar.SATURDAY) {
            startDay = Calendar.SUNDAY;
        }
        dayList.add(dayOfWeekArray[startDay - 1]);
    }
    Recur recur = new Recur(Recur.DAILY, 0);
    recur.getDayList().addAll(dayList);
    this.state.addRecur(recur);
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:18,代码来源:ICalRecurConverter.java

示例3: DayInMonth

/**
 * @param dayOfWeek An integer in the range of <code>Calendar.SUNDAY</code>
 * to <code>Calendar.SATURDAY</code>
 * @param occurrence An integer in the range of -5 to 5, excluding zero
 */
public DayInMonth(int dayOfWeek, int occurrence) {
    if (dayOfWeek < Calendar.SUNDAY || dayOfWeek > Calendar.SATURDAY) {
        throw new IllegalArgumentException("Invalid day argument");
    }
    if (occurrence < -5 || occurrence == 0 || occurrence > 5) {
        throw new IllegalArgumentException("Invalid occurrence argument");
    }
    this.dayOfWeek = dayOfWeek;
    this.occurrence = occurrence;
    int result = occurrence;
    if (result < 0) {
        // Make negative values a higher sequence
        // Example: Last Monday should come after first Monday
        result += 11;
    }
    this.sequence = SEQUENCE_DAY_IN_MONTH + (result * 10) + dayOfWeek;
    if (Debug.verboseOn()) {
        Debug.logVerbose("Created " + this, module);
    }
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:25,代码来源:TemporalExpressions.java

示例4: getCalendarDay

private int getCalendarDay(String day) {
    if (day != null) day = day.trim();
    if (day.equalsIgnoreCase("MO"))
        return Calendar.MONDAY;
    if (day.equalsIgnoreCase("TU"))
        return Calendar.TUESDAY;
    if (day.equalsIgnoreCase("WE"))
        return Calendar.WEDNESDAY;
    if (day.equalsIgnoreCase("TH"))
        return Calendar.THURSDAY;
    if (day.equalsIgnoreCase("FR"))
        return Calendar.FRIDAY;
    if (day.equalsIgnoreCase("SA"))
        return Calendar.SATURDAY;
    if (day.equalsIgnoreCase("SU"))
        return Calendar.SUNDAY;
    return 0;
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:18,代码来源:RecurrenceRule.java

示例5: getDayPeriodSummaryString

public static String getDayPeriodSummaryString(Context context, int[] daysOfWeek) {
    int[] weekdays = { Calendar.MONDAY, Calendar.TUESDAY, Calendar.WEDNESDAY, Calendar.THURSDAY,
            Calendar.FRIDAY };
    int[] weekend = { Calendar.SUNDAY, Calendar.SATURDAY };
    int[] everyday = { Calendar.SUNDAY, Calendar.MONDAY, Calendar.TUESDAY, Calendar.WEDNESDAY,
            Calendar.THURSDAY, Calendar.FRIDAY, Calendar.SATURDAY };
    if (Arrays.equals(daysOfWeek, weekend)) {
        return context.getString(R.string.alarm_list_weekend);
    } else if (Arrays.equals(daysOfWeek, weekdays)) {
        return context.getString(R.string.alarm_list_weekdays);
    } else if (Arrays.equals(daysOfWeek, everyday)) {
        return context.getString(R.string.alarm_list_every_day);
    } else {
        return getShortDayNamesString(daysOfWeek);
    }
}
 
开发者ID:Microsoft,项目名称:ProjectOxford-Apps-MimickerAlarm,代码行数:16,代码来源:DateTimeUtilities.java

示例6: getOffset

/**
 * TimeZone API.
 */
public int getOffset(int era, int year, int month,int dom, int dow, int millis, int monthLength){

    if ((era != GregorianCalendar.AD && era != GregorianCalendar.BC)
        || month < Calendar.JANUARY
        || month > Calendar.DECEMBER
        || dom < 1
        || dom > monthLength
        || dow < Calendar.SUNDAY
        || dow > Calendar.SATURDAY
        || millis < 0
        || millis >= Grego.MILLIS_PER_DAY
        || monthLength < 28
        || monthLength > 31) {
        throw new IllegalArgumentException();
    }

    if (era == GregorianCalendar.BC) {
        year = -year;
    }

    if (finalZone != null && year >= finalStartYear) {
        return finalZone.getOffset(era, year, month, dom, dow, millis);
    }

    // Compute local epoch millis from input fields
    long time = Grego.fieldsToDay(year, month, dom) * Grego.MILLIS_PER_DAY + millis;

    int[] offsets = new int[2];
    getHistoricalOffset(time, true, LOCAL_DST, LOCAL_STD, offsets);
    return offsets[0] + offsets[1];
}
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:34,代码来源:OlsonTimeZone.java

示例7: setFirstDayOfWeek

@SuppressWarnings("unused")
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:Tabrizian,项目名称:PersianAndroidDateTimePicker,代码行数:11,代码来源:DatePickerDialog.java

示例8: weekNumber

public static int weekNumber(Timestamp input, int startOfWeek) {
    Calendar calendar = Calendar.getInstance();
    calendar.setFirstDayOfWeek(startOfWeek);

    if (startOfWeek == Calendar.MONDAY) {
       calendar.setMinimalDaysInFirstWeek(4);
    } else if (startOfWeek == Calendar.SUNDAY) {
       calendar.setMinimalDaysInFirstWeek(3);
    }

    calendar.setTime(new java.util.Date(input.getTime()));
    return calendar.get(Calendar.WEEK_OF_YEAR);
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:13,代码来源:UtilDateTime.java

示例9: DayOfWeekRange

/**
 * @param start An integer in the range of <code>Calendar.SUNDAY</code>
 * to <code>Calendar.SATURDAY</code>
 * @param end An integer in the range of <code>Calendar.SUNDAY</code>
 * to <code>Calendar.SATURDAY</code>
 */
public DayOfWeekRange(int start, int end) {
    if (start < Calendar.SUNDAY || start > Calendar.SATURDAY) {
        throw new IllegalArgumentException("Invalid start argument");
    }
    if (end < Calendar.SUNDAY || end > Calendar.SATURDAY) {
        throw new IllegalArgumentException("Invalid end argument");
    }
    this.sequence = SEQUENCE_DOW_RANGE + start;
    this.start = start;
    this.end = end;
    if (Debug.verboseOn()) {
        Debug.logVerbose("Created " + this, module);
    }
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:20,代码来源:TemporalExpressions.java

示例10: getShortDayNames

public static String[] getShortDayNames() {
    String[] dayNames = new String[7];
    Format formatter = new SimpleDateFormat(TWO_CHARACTER_SHORT_DAY_PATTERN, Locale.getDefault());
    Calendar calendar = Calendar.getInstance();
    for(int d = Calendar.SUNDAY, i = 0; d <= Calendar.SATURDAY; d++, i++) {
        calendar.set(Calendar.DAY_OF_WEEK, d);
        dayNames[i] = formatter.format(calendar.getTime()).toUpperCase(Locale.getDefault());
    }
    return dayNames;
}
 
开发者ID:Microsoft,项目名称:ProjectOxford-Apps-MimickerAlarm,代码行数:10,代码来源:DateTimeUtilities.java

示例11: dayStartCapacityAvailable

/** Used to find the fisrt day in the TechDataCalendarWeek where capacity != 0, beginning at dayStart, dayStart included.
 *
 * @param techDataCalendarWeek        The TechDataCalendarWeek cover
 * @param dayStart
 * @return a map with the  capacity (Double) available and moveDay (int): the number of day it's necessary to move to have capacity available
 */
public static Map<String, Object> dayStartCapacityAvailable(GenericValue techDataCalendarWeek,  int  dayStart) {
    Map<String, Object> result = FastMap.newInstance();
    int moveDay = 0;
    Double capacity = null;
    Time startTime = null;
    while (capacity == null || capacity.doubleValue()==0) {
        switch (dayStart) {
            case Calendar.MONDAY:
                capacity =  techDataCalendarWeek.getDouble("mondayCapacity");
                startTime =  techDataCalendarWeek.getTime("mondayStartTime");
                break;
            case Calendar.TUESDAY:
                capacity =  techDataCalendarWeek.getDouble("tuesdayCapacity");
                startTime =  techDataCalendarWeek.getTime("tuesdayStartTime");
                break;
            case Calendar.WEDNESDAY:
                capacity =  techDataCalendarWeek.getDouble("wednesdayCapacity");
                startTime =  techDataCalendarWeek.getTime("wednesdayStartTime");
                break;
            case Calendar.THURSDAY:
                capacity =  techDataCalendarWeek.getDouble("thursdayCapacity");
                startTime =  techDataCalendarWeek.getTime("thursdayStartTime");
                break;
            case Calendar.FRIDAY:
                capacity =  techDataCalendarWeek.getDouble("fridayCapacity");
                startTime =  techDataCalendarWeek.getTime("fridayStartTime");
                break;
            case Calendar.SATURDAY:
                capacity =  techDataCalendarWeek.getDouble("saturdayCapacity");
                startTime =  techDataCalendarWeek.getTime("saturdayStartTime");
                break;
            case Calendar.SUNDAY:
                capacity =  techDataCalendarWeek.getDouble("sundayCapacity");
                startTime =  techDataCalendarWeek.getTime("sundayStartTime");
                break;
        }
        if (capacity == null || capacity.doubleValue() == 0) {
            moveDay +=1;
            dayStart = (dayStart==7) ? 1 : dayStart +1;
        }
        //                Debug.logInfo("capacity loop: " + capacity+ " moveDay=" +moveDay, module);
    }
    result.put("capacity",capacity);
    result.put("startTime",startTime);
    result.put("moveDay",Integer.valueOf(moveDay));
    return result;
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:53,代码来源:TechDataServices.java

示例12: dayEndCapacityAvailable

/** Used to find the last day in the TechDataCalendarWeek where capacity != 0, ending at dayEnd, dayEnd included.
 *
 * @param techDataCalendarWeek        The TechDataCalendarWeek cover
 * @param dayEnd
 * @return a map with the  capacity (Double) available, the startTime and  moveDay (int): the number of day it's necessary to move to have capacity available
 */
public static Map<String, Object> dayEndCapacityAvailable(GenericValue techDataCalendarWeek, int dayEnd) {
    Map<String, Object> result = FastMap.newInstance();
    int moveDay = 0;
    Double capacity = null;
    Time startTime = null;
    while (capacity == null || capacity.doubleValue() == 0) {
        switch (dayEnd) {
            case Calendar.MONDAY:
                capacity =  techDataCalendarWeek.getDouble("mondayCapacity");
                startTime =  techDataCalendarWeek.getTime("mondayStartTime");
                break;
            case Calendar.TUESDAY:
                capacity =  techDataCalendarWeek.getDouble("tuesdayCapacity");
                startTime =  techDataCalendarWeek.getTime("tuesdayStartTime");
                break;
            case Calendar.WEDNESDAY:
                capacity =  techDataCalendarWeek.getDouble("wednesdayCapacity");
                startTime =  techDataCalendarWeek.getTime("wednesdayStartTime");
                break;
            case Calendar.THURSDAY:
                capacity =  techDataCalendarWeek.getDouble("thursdayCapacity");
                startTime =  techDataCalendarWeek.getTime("thursdayStartTime");
                break;
            case Calendar.FRIDAY:
                capacity =  techDataCalendarWeek.getDouble("fridayCapacity");
                startTime =  techDataCalendarWeek.getTime("fridayStartTime");
                break;
            case Calendar.SATURDAY:
                capacity =  techDataCalendarWeek.getDouble("saturdayCapacity");
                startTime =  techDataCalendarWeek.getTime("saturdayStartTime");
                break;
            case Calendar.SUNDAY:
                capacity =  techDataCalendarWeek.getDouble("sundayCapacity");
                startTime =  techDataCalendarWeek.getTime("sundayStartTime");
                break;
        }
        if (capacity == null || capacity.doubleValue() == 0) {
            moveDay -=1;
            dayEnd = (dayEnd==1) ? 7 : dayEnd - 1;
        }
    }
    result.put("capacity",capacity);
    result.put("startTime",startTime);
    result.put("moveDay",Integer.valueOf(moveDay));
    return result;
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:52,代码来源:TechDataServices.java


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