本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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);
}