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


Java Calendar.HOUR属性代码示例

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


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

示例1: validateAndProcessPatternLetter

/**
 * Processes the pattern letter
 * @param patternLetter
 * @return Pattern letter
 */
private CharSequence validateAndProcessPatternLetter(CharSequence patternLetter) {
    // Check that patternLetter is just one letter
    if (patternLetter.length() != 1) { return null; }

    // Check that the pattern letter is accepted
    char letter = patternLetter.charAt(0);
    if (ACCEPTED_PATTERN_LETTERS.indexOf(letter) < 0) {
        return null;
    }

    // Replace 'h' for 'H'
    if (letter == CALENDAR_FIELD_TO_PATTERN_LETTER[Calendar.HOUR_OF_DAY].charAt(0)) {
        patternLetter = CALENDAR_FIELD_TO_PATTERN_LETTER[Calendar.HOUR];
    }

    return patternLetter;
}
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:22,代码来源:DateIntervalInfo.java

示例2: Frequency

/**
 * @param start Starting date, defaults to current system time
 * @param freqType One of the following integer values: <code>Calendar.SECOND
 * Calendar.MINUTE Calendar.HOUR Calendar.DAY_OF_MONTH Calendar.MONTH
 * Calendar.YEAR</code>
 * @param freqCount A positive integer
 */
public Frequency(Date start, int freqType, int freqCount) {
    if (freqType != Calendar.SECOND && freqType != Calendar.MINUTE
            && freqType != Calendar.HOUR && freqType != Calendar.DAY_OF_MONTH
            && freqType != Calendar.MONTH && freqType != Calendar.YEAR) {
        throw new IllegalArgumentException("Invalid freqType argument");
    }
    if (freqCount < 1) {
        throw new IllegalArgumentException("freqCount argument must be a positive integer");
    }
    if (start != null) {
        this.start = start;
    } else {
        this.start = new Date();
    }
    this.sequence = SEQUENCE_FREQ + freqType;
    this.freqType = freqType;
    this.freqCount = freqCount;
    if (Debug.verboseOn()) {
        Debug.logVerbose("Created " + this, module);
    }
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:28,代码来源:TemporalExpressions.java

示例3: getPatterns

/**
 * @internal
 * @deprecated This API is ICU internal only.
 */
@Deprecated
public String getPatterns(Calendar fromCalendar,
        Calendar toCalendar, 
        Output<String> part2) {
    // First, find the largest different calendar field.
    int field;
    if ( fromCalendar.get(Calendar.ERA) != toCalendar.get(Calendar.ERA) ) {
        field = Calendar.ERA;
    } else if ( fromCalendar.get(Calendar.YEAR) != 
                toCalendar.get(Calendar.YEAR) ) {
        field = Calendar.YEAR;
    } else if ( fromCalendar.get(Calendar.MONTH) !=
                toCalendar.get(Calendar.MONTH) ) {
        field = Calendar.MONTH;
    } else if ( fromCalendar.get(Calendar.DATE) !=
                toCalendar.get(Calendar.DATE) ) {
        field = Calendar.DATE;
    } else if ( fromCalendar.get(Calendar.AM_PM) !=
                toCalendar.get(Calendar.AM_PM) ) {
        field = Calendar.AM_PM;
    } else if ( fromCalendar.get(Calendar.HOUR) !=
                toCalendar.get(Calendar.HOUR) ) {
        field = Calendar.HOUR;
    } else if ( fromCalendar.get(Calendar.MINUTE) !=
                toCalendar.get(Calendar.MINUTE) ) {
        field = Calendar.MINUTE;
    } else if ( fromCalendar.get(Calendar.SECOND) !=
                toCalendar.get(Calendar.SECOND) ) {
        field = Calendar.SECOND;
    } else {
        return null;
    }
    PatternInfo intervalPattern = fIntervalPatterns.get(
            DateIntervalInfo.CALENDAR_FIELD_TO_PATTERN_LETTER[field]);
    part2.value = intervalPattern.getSecondPart();
    return intervalPattern.getFirstPart();
}
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:41,代码来源:DateIntervalFormat.java

示例4: visit

@Override
public void visit(TemporalExpressions.Frequency expr) {
    if (this.dateStart == null) {
        this.dateStart = new DtStart(new net.fortuna.ical4j.model.Date(expr.getStartDate()));
    }
    int freqCount = expr.getFreqCount();
    int freqType = expr.getFreqType();
    switch (freqType) {
    case Calendar.SECOND:
        this.state.addRecur((new Recur(Recur.SECONDLY, freqCount)));
        break;
    case Calendar.MINUTE:
        this.state.addRecur((new Recur(Recur.MINUTELY, freqCount)));
        break;
    case Calendar.HOUR:
        this.state.addRecur((new Recur(Recur.HOURLY, freqCount)));
        break;
    case Calendar.DAY_OF_MONTH:
        this.state.addRecur((new Recur(Recur.DAILY, freqCount)));
        break;
    case Calendar.MONTH:
        this.state.addRecur((new Recur(Recur.MONTHLY, freqCount)));
        break;
    case Calendar.YEAR:
        this.state.addRecur((new Recur(Recur.YEARLY, freqCount)));
        break;
    }
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:28,代码来源:ICalRecurConverter.java

示例5: prepareCal

protected Calendar prepareCal(Calendar cal) {
    // Performs a "sane" skip forward in time - avoids time consuming loops
    // like incrementing every second from Jan 1 2000 until today
    Calendar skip = (Calendar) cal.clone();
    skip.setTime(this.start);
    long deltaMillis = cal.getTimeInMillis() - this.start.getTime();
    if (deltaMillis < 1000) {
        return skip;
    }
    long divisor = deltaMillis;
    if (this.freqType == Calendar.DAY_OF_MONTH) {
        divisor = 86400000;
    } else if (this.freqType == Calendar.HOUR) {
        divisor = 3600000;
    } else if (this.freqType == Calendar.MINUTE) {
        divisor = 60000;
    } else if (this.freqType == Calendar.SECOND) {
        divisor = 1000;
    } else {
        return skip;
    }
    long units = deltaMillis / divisor;
    units -= units % this.freqCount;
    skip.add(this.freqType, (int)units);
    while (skip.after(cal)) {
        skip.add(this.freqType, -this.freqCount);
    }
    return skip;
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:29,代码来源:TemporalExpressions.java

示例6: uomTimeToCalTime

public static int[] uomTimeToCalTime(String uomId) {
    if ("TF_ms".equals(uomId)) {
        return new int[] { Calendar.MILLISECOND, 1 };
    } else if ("TF_s".equals(uomId)) {
        return new int[] { Calendar.SECOND, 1 };
    } else if ("TF_min".equals(uomId)) {
        return new int[] { Calendar.MINUTE, 1 };
    } else if ("TF_hr".equals(uomId)) {
        return new int[] { Calendar.HOUR, 1 };
    } else if ("TF_day".equals(uomId)) {
        return new int[] { Calendar.DAY_OF_YEAR, 1 };
    } else if ("TF_wk".equals(uomId)) {
        return new int[] { Calendar.WEEK_OF_YEAR, 1 };
    } else if ("TF_mon".equals(uomId)) {
        return new int[] { Calendar.MONTH, 1 };
    } else if ("TF_yr".equals(uomId)) {
        return new int[] { Calendar.YEAR, 1 };
    } else if ("TF_decade".equals(uomId)) {
        return new int[] { Calendar.YEAR, 10 };
    } else if ("TF_score".equals(uomId)) {
        return new int[] { Calendar.YEAR, 20 };
    } else if ("TF_century".equals(uomId)) {
        return new int[] { Calendar.YEAR, 100 };
    } else if ("TF_millenium".equals(uomId)) {
        return new int[] { Calendar.YEAR, 1000 };
    }

    return null;
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:29,代码来源:UomWorker.java


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