/** * Creates a <code>Minutes</code> representing the number of whole minutes * between the two specified datetimes. * * @param start the start instant, must not be null * @param end the end instant, must not be null * @return the period in minutes * @throws IllegalArgumentException if the instants are null or invalid */ public static Minutes minutesBetween(ReadableInstant start, ReadableInstant end) { int amount = BaseSingleFieldPeriod.between(start, end, DurationFieldType.minutes()); return Minutes.minutes(amount); }
/** * Creates a <code>Seconds</code> representing the number of whole seconds * between the two specified datetimes. * * @param start the start instant, must not be null * @param end the end instant, must not be null * @return the period in seconds * @throws IllegalArgumentException if the instants are null or invalid */ public static Seconds secondsBetween(ReadableInstant start, ReadableInstant end) { int amount = BaseSingleFieldPeriod.between(start, end, DurationFieldType.seconds()); return Seconds.seconds(amount); }
/** * Creates a <code>Weeks</code> representing the number of whole weeks * between the two specified datetimes. * * @param start the start instant, must not be null * @param end the end instant, must not be null * @return the period in weeks * @throws IllegalArgumentException if the instants are null or invalid */ public static Weeks weeksBetween(ReadableInstant start, ReadableInstant end) { int amount = BaseSingleFieldPeriod.between(start, end, DurationFieldType.weeks()); return Weeks.weeks(amount); }
/** * Creates a <code>Hours</code> representing the number of whole hours * between the two specified datetimes. * * @param start the start instant, must not be null * @param end the end instant, must not be null * @return the period in hours * @throws IllegalArgumentException if the instants are null or invalid */ public static Hours hoursBetween(ReadableInstant start, ReadableInstant end) { int amount = BaseSingleFieldPeriod.between(start, end, DurationFieldType.hours()); return Hours.hours(amount); }
/** * Creates a <code>Days</code> representing the number of whole days * between the two specified datetimes. This method correctly handles * any daylight savings time changes that may occur during the interval. * * @param start the start instant, must not be null * @param end the end instant, must not be null * @return the period in days * @throws IllegalArgumentException if the instants are null or invalid */ public static Days daysBetween(ReadableInstant start, ReadableInstant end) { int amount = BaseSingleFieldPeriod.between(start, end, DurationFieldType.days()); return Days.days(amount); }
/** * Creates a <code>Years</code> representing the number of whole years * between the two specified datetimes. This method correctly handles * any daylight savings time changes that may occur during the interval. * * @param start the start instant, must not be null * @param end the end instant, must not be null * @return the period in years * @throws IllegalArgumentException if the instants are null or invalid */ public static Years yearsBetween(ReadableInstant start, ReadableInstant end) { int amount = BaseSingleFieldPeriod.between(start, end, DurationFieldType.years()); return Years.years(amount); }
/** * Creates a <code>Seconds</code> representing the number of whole seconds * between the two specified datetimes. * * @param start the start instant, must not be null * @param end the end instant, must not be null * @return the period in seconds * @throws IllegalArgumentException if the instants are null or invalid */ public static Seconds secondsBetween(ReadableInstant start, ReadableInstant end) { int amount = BaseSingleFieldPeriod.between(start, end, DurationFieldType.seconds()); return Seconds.seconds(amount); }
/** * Creates a <code>Hours</code> representing the number of whole hours * between the two specified datetimes. * * @param start the start instant, must not be null * @param end the end instant, must not be null * @return the period in hours * @throws IllegalArgumentException if the instants are null or invalid */ public static Hours hoursBetween(ReadableInstant start, ReadableInstant end) { int amount = BaseSingleFieldPeriod.between(start, end, DurationFieldType.hours()); return Hours.hours(amount); }
/** * Creates a <code>Weeks</code> representing the number of whole weeks * between the two specified datetimes. * * @param start the start instant, must not be null * @param end the end instant, must not be null * @return the period in weeks * @throws IllegalArgumentException if the instants are null or invalid */ public static Weeks weeksBetween(ReadableInstant start, ReadableInstant end) { int amount = BaseSingleFieldPeriod.between(start, end, DurationFieldType.weeks()); return Weeks.weeks(amount); }
/** * Creates a <code>Minutes</code> representing the number of whole minutes * between the two specified datetimes. * * @param start the start instant, must not be null * @param end the end instant, must not be null * @return the period in minutes * @throws IllegalArgumentException if the instants are null or invalid */ public static Minutes minutesBetween(ReadableInstant start, ReadableInstant end) { int amount = BaseSingleFieldPeriod.between(start, end, DurationFieldType.minutes()); return Minutes.minutes(amount); }
/** * Creates a <code>Years</code> representing the number of whole years * between the two specified datetimes. This method correctly handles * any daylight savings time changes that may occur during the interval. * * @param start the start instant, must not be null * @param end the end instant, must not be null * @return the period in years * @throws IllegalArgumentException if the instants are null or invalid */ public static Years yearsBetween(ReadableInstant start, ReadableInstant end) { int amount = BaseSingleFieldPeriod.between(start, end, DurationFieldType.years()); return Years.years(amount); }
/** * Creates a <code>Days</code> representing the number of whole days * between the two specified datetimes. This method correctly handles * any daylight savings time changes that may occur during the interval. * * @param start the start instant, must not be null * @param end the end instant, must not be null * @return the period in days * @throws IllegalArgumentException if the instants are null or invalid */ public static Days daysBetween(ReadableInstant start, ReadableInstant end) { int amount = BaseSingleFieldPeriod.between(start, end, DurationFieldType.days()); return Days.days(amount); }
/** * Creates a <code>Weeks</code> representing the number of whole weeks * in the specified interval. * * @param interval the interval to extract weeks from, null returns zero * @return the period in weeks * @throws IllegalArgumentException if the partials are null or invalid */ public static Weeks weeksIn(ReadableInterval interval) { if (interval == null) { return Weeks.ZERO; } int amount = BaseSingleFieldPeriod.between(interval.getStart(), interval.getEnd(), DurationFieldType.weeks()); return Weeks.weeks(amount); }
/** * Creates a <code>Hours</code> representing the number of whole hours * in the specified interval. * * @param interval the interval to extract hours from, null returns zero * @return the period in hours * @throws IllegalArgumentException if the partials are null or invalid */ public static Hours hoursIn(ReadableInterval interval) { if (interval == null) { return Hours.ZERO; } int amount = BaseSingleFieldPeriod.between(interval.getStart(), interval.getEnd(), DurationFieldType.hours()); return Hours.hours(amount); }
/** * Creates a <code>Minutes</code> representing the number of whole minutes * in the specified interval. * * @param interval the interval to extract minutes from, null returns zero * @return the period in minutes * @throws IllegalArgumentException if the partials are null or invalid */ public static Minutes minutesIn(ReadableInterval interval) { if (interval == null) { return Minutes.ZERO; } int amount = BaseSingleFieldPeriod.between(interval.getStart(), interval.getEnd(), DurationFieldType.minutes()); return Minutes.minutes(amount); }
/** * Creates a <code>Seconds</code> representing the number of whole seconds * in the specified interval. * * @param interval the interval to extract seconds from, null returns zero * @return the period in seconds * @throws IllegalArgumentException if the partials are null or invalid */ public static Seconds secondsIn(ReadableInterval interval) { if (interval == null) { return Seconds.ZERO; } int amount = BaseSingleFieldPeriod.between(interval.getStart(), interval.getEnd(), DurationFieldType.seconds()); return Seconds.seconds(amount); }
/** * Creates a <code>Days</code> representing the number of whole days * in the specified interval. This method correctly handles any daylight * savings time changes that may occur during the interval. * * @param interval the interval to extract days from, null returns zero * @return the period in days * @throws IllegalArgumentException if the partials are null or invalid */ public static Days daysIn(ReadableInterval interval) { if (interval == null) { return Days.ZERO; } int amount = BaseSingleFieldPeriod.between(interval.getStart(), interval.getEnd(), DurationFieldType.days()); return Days.days(amount); }
/** * Creates a <code>Months</code> representing the number of whole months * in the specified interval. This method correctly handles any daylight * savings time changes that may occur during the interval. * * @param interval the interval to extract months from, null returns zero * @return the period in months * @throws IllegalArgumentException if the partials are null or invalid */ public static Months monthsIn(ReadableInterval interval) { if (interval == null) { return Months.ZERO; } int amount = BaseSingleFieldPeriod.between(interval.getStart(), interval.getEnd(), DurationFieldType.months()); return Months.months(amount); }
/** * Creates a <code>Years</code> representing the number of whole years * in the specified interval. This method correctly handles any daylight * savings time changes that may occur during the interval. * * @param interval the interval to extract years from, null returns zero * @return the period in years * @throws IllegalArgumentException if the partials are null or invalid */ public static Years yearsIn(ReadableInterval interval) { if (interval == null) { return Years.ZERO; } int amount = BaseSingleFieldPeriod.between(interval.getStart(), interval.getEnd(), DurationFieldType.years()); return Years.years(amount); }
/** * Creates a <code>Seconds</code> representing the number of whole seconds * in the specified interval. * * @param interval the interval to extract seconds from, null returns zero * @return the period in seconds * @throws IllegalArgumentException if the partials are null or invalid */ public static Seconds secondsIn(ReadableInterval interval) { if (interval == null) { return Seconds.ZERO; } int amount = BaseSingleFieldPeriod.between(interval.getStart(), interval.getEnd(), DurationFieldType.seconds()); return Seconds.seconds(amount); }