/** * @param instant millis from 1970-01-01T00:00:00Z * @param year precalculated year of millis */ int getDayOfYear(long instant, int year) { long yearStart = getYearMillis(year); return (int) ((instant - yearStart) / DateTimeConstants.MILLIS_PER_DAY) + 1; }
/** * @param instant millis from 1970-01-01T00:00:00Z * @param year precalculated year of millis */ int getDayOfYear(long instant, int year) { long yearStart = getYearMillis(year); return (int) ((instant - yearStart) / DateTimeConstants.MILLIS_PER_DAY) + 1; }
public long roundCeiling(long instant) { int year = get(instant); long yearStartMillis = iChronology.getYearMillis(year); if (instant != yearStartMillis) { // Bump up to start of next year. instant = iChronology.getYearMillis(year + 1); } return instant; }
public long roundCeiling(long instant) { int year = get(instant); long yearStartMillis = iChronology.getYearMillis(year); if (instant != yearStartMillis) { // Bump up to start of next year. instant = iChronology.getYearMillis(year + 1); } return instant; }
/** * Get the milliseconds for the start of a month. * * @param year The year to use. * @param month The month to use * @return millis from 1970-01-01T00:00:00Z */ long getYearMonthMillis(int year, int month) { long millis = getYearMillis(year); millis += getTotalMillisByYearMonth(year, month); return millis; }
/** * @param millis from 1970-01-01T00:00:00Z * @param year precalculated year of millis * @param month precalculated month of millis */ int getDayOfMonth(long millis, int year, int month) { long dateMillis = getYearMillis(year); dateMillis += getTotalMillisByYearMonth(year, month); return (int) ((millis - dateMillis) / DateTimeConstants.MILLIS_PER_DAY) + 1; }
/** * Get the milliseconds for the start of a month. * * @param year The year to use. * @param month The month to use * @return millis from 1970-01-01T00:00:00Z */ long getYearMonthMillis(int year, int month) { long millis = getYearMillis(year); millis += getTotalMillisByYearMonth(year, month); return millis; }
/** * Get the milliseconds for a particular date. * * @param year The year to use. * @param month The month to use * @param dayOfMonth The day of the month to use * @return millis from 1970-01-01T00:00:00Z */ long getYearMonthDayMillis(int year, int month, int dayOfMonth) { long millis = getYearMillis(year); millis += getTotalMillisByYearMonth(year, month); return millis + (dayOfMonth - 1) * (long)DateTimeConstants.MILLIS_PER_DAY; }
/** * @param millis from 1970-01-01T00:00:00Z * @param year precalculated year of millis * @param month precalculated month of millis */ int getDayOfMonth(long millis, int year, int month) { long dateMillis = getYearMillis(year); dateMillis += getTotalMillisByYearMonth(year, month); return (int) ((millis - dateMillis) / DateTimeConstants.MILLIS_PER_DAY) + 1; }
public long roundFloor(long instant) { return iChronology.getYearMillis(get(instant)); }
/** * Get the milliseconds for a particular date. * * @param year The year to use. * @param month The month to use * @param dayOfMonth The day of the month to use * @return millis from 1970-01-01T00:00:00Z */ long getYearMonthDayMillis(int year, int month, int dayOfMonth) { long millis = getYearMillis(year); millis += getTotalMillisByYearMonth(year, month); return millis + (dayOfMonth - 1) * (long)DateTimeConstants.MILLIS_PER_DAY; }
public long roundFloor(long instant) { return iChronology.getYearMillis(get(instant)); }
/** * Get the millis for the first week of a year. * * @param year the year to use * @return millis */ long getFirstWeekOfYearMillis(int year) { long jan1millis = getYearMillis(year); int jan1dayOfWeek = getDayOfWeek(jan1millis); if (jan1dayOfWeek > (8 - iMinDaysInFirstWeek)) { // First week is end of previous year because it doesn't have enough days. return jan1millis + (8 - jan1dayOfWeek) * (long)DateTimeConstants.MILLIS_PER_DAY; } else { // First week is start of this year because it has enough days. return jan1millis - (jan1dayOfWeek - 1) * (long)DateTimeConstants.MILLIS_PER_DAY; } }
/** * Get the millis for the first week of a year. * * @param year the year to use * @return millis */ long getFirstWeekOfYearMillis(int year) { long jan1millis = getYearMillis(year); int jan1dayOfWeek = getDayOfWeek(jan1millis); if (jan1dayOfWeek > (8 - iMinDaysInFirstWeek)) { // First week is end of previous year because it doesn't have enough days. return jan1millis + (8 - jan1dayOfWeek) * (long)DateTimeConstants.MILLIS_PER_DAY; } else { // First week is start of this year because it has enough days. return jan1millis - (jan1dayOfWeek - 1) * (long)DateTimeConstants.MILLIS_PER_DAY; } }
long yearStart = getYearMillis(year); long diff = instant - yearStart;
long yearStart = getYearMillis(year); long diff = instant - yearStart;
/** * @param instant millis from 1970-01-01T00:00:00Z * @param year precalculated year of millis */ int getDayOfYear(long instant, int year) { long yearStart = getYearMillis(year); return (int) ((instant - yearStart) / DateTimeConstants.MILLIS_PER_DAY) + 1; }
public long roundCeiling(long instant) { int year = get(instant); long yearStartMillis = iChronology.getYearMillis(year); if (instant != yearStartMillis) { // Bump up to start of next year. instant = iChronology.getYearMillis(year + 1); } return instant; }
/** * @param millis from 1970-01-01T00:00:00Z * @param year precalculated year of millis * @param month precalculated month of millis */ int getDayOfMonth(long millis, int year, int month) { long dateMillis = getYearMillis(year); dateMillis += getTotalMillisByYearMonth(year, month); return (int) ((millis - dateMillis) / DateTimeConstants.MILLIS_PER_DAY) + 1; }
/** * Get the milliseconds for the start of a month. * * @param year The year to use. * @param month The month to use * @return millis from 1970-01-01T00:00:00Z */ long getYearMonthMillis(int year, int month) { long millis = getYearMillis(year); millis += getTotalMillisByYearMonth(year, month); return millis; }