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


Java DateTimeConstants.MILLIS_PER_WEEK属性代码示例

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


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

示例1: getDifferenceAsLong

public long getDifferenceAsLong(long minuendInstant, long subtrahendInstant) {
    if (minuendInstant < subtrahendInstant) {
        return -getDifference(subtrahendInstant, minuendInstant);
    }

    int minuendWeekyear = get(minuendInstant);
    int subtrahendWeekyear = get(subtrahendInstant);

    long minuendRem = remainder(minuendInstant);
    long subtrahendRem = remainder(subtrahendInstant);

    // Balance leap weekyear differences on remainders.
    if (subtrahendRem >= WEEK_53 && iChronology.getWeeksInYear(minuendWeekyear) <= 52) {
        subtrahendRem -= DateTimeConstants.MILLIS_PER_WEEK;
    }

    int difference = minuendWeekyear - subtrahendWeekyear;
    if (minuendRem < subtrahendRem) {
        difference--;
    }
    return difference;
}
 
开发者ID:redfish64,项目名称:TinyTravelTracker,代码行数:22,代码来源:BasicWeekyearDateTimeField.java

示例2: roundFloor

public long roundFloor(long instant) {
    // Note: This works fine, but it ideally shouldn't invoke other
    // fields from within a field.
    instant = iChronology.weekOfWeekyear().roundFloor(instant);
    int wow = iChronology.getWeekOfWeekyear(instant);
    if (wow > 1) {
        instant -= ((long) DateTimeConstants.MILLIS_PER_WEEK) * (wow - 1);
    }
    return instant;
}
 
开发者ID:redfish64,项目名称:TinyTravelTracker,代码行数:10,代码来源:BasicWeekyearDateTimeField.java

示例3: getWeekOfWeekyear

/**
 * @param instant millis from 1970-01-01T00:00:00Z
 * @param year precalculated year of millis
 */
int getWeekOfWeekyear(long instant, int year) {
    long firstWeekMillis1 = getFirstWeekOfYearMillis(year);
    if (instant < firstWeekMillis1) {
        return getWeeksInYear(year - 1);
    }
    long firstWeekMillis2 = getFirstWeekOfYearMillis(year + 1);
    if (instant >= firstWeekMillis2) {
        return 1;
    }
    return (int) ((instant - firstWeekMillis1) / DateTimeConstants.MILLIS_PER_WEEK) + 1;
}
 
开发者ID:redfish64,项目名称:TinyTravelTracker,代码行数:15,代码来源:BasicChronology.java

示例4: getWeeksInYear

/**
 * Get the number of weeks in the year.
 *
 * @param year  the year to use
 * @return number of weeks in the year
 */
int getWeeksInYear(int year) {
    long firstWeekMillis1 = getFirstWeekOfYearMillis(year);
    long firstWeekMillis2 = getFirstWeekOfYearMillis(year + 1);
    return (int) ((firstWeekMillis2 - firstWeekMillis1) / DateTimeConstants.MILLIS_PER_WEEK);
}
 
开发者ID:redfish64,项目名称:TinyTravelTracker,代码行数:11,代码来源:BasicChronology.java


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