/** * Obtains an instance of {@code ZoneOffset} using an offset in hours. * * @param hours the time-zone offset in hours, from -18 to +18 * @return the zone-offset, not null * @throws DateTimeException if the offset is not in the required range */ public static ZoneOffset ofHours(int hours) { return ofHoursMinutesSeconds(hours, 0, 0); }
/** * Obtains an instance of {@code ZoneOffset} using an offset in hours. * * @param hours the time-zone offset in hours, from -18 to +18 * @return the zone-offset, not null * @throws DateTimeException if the offset is not in the required range */ public static ZoneOffset ofHours(int hours) { return ofHoursMinutesSeconds(hours, 0, 0); }
/** * Obtains an instance of {@code ZoneOffset} using an offset in * hours and minutes. * <p> * The sign of the hours and minutes components must match. * Thus, if the hours is negative, the minutes must be negative or zero. * If the hours is zero, the minutes may be positive, negative or zero. * * @param hours the time-zone offset in hours, from -18 to +18 * @param minutes the time-zone offset in minutes, from 0 to ±59, sign matches hours * @return the zone-offset, not null * @throws DateTimeException if the offset is not in the required range */ public static ZoneOffset ofHoursMinutes(int hours, int minutes) { return ofHoursMinutesSeconds(hours, minutes, 0); }
/** * Obtains an instance of {@code ZoneOffset} using an offset in * hours and minutes. * <p> * The sign of the hours and minutes components must match. * Thus, if the hours is negative, the minutes must be negative or zero. * If the hours is zero, the minutes may be positive, negative or zero. * * @param hours the time-zone offset in hours, from -18 to +18 * @param minutes the time-zone offset in minutes, from 0 to ±59, sign matches hours * @return the zone-offset, not null * @throws DateTimeException if the offset is not in the required range */ public static ZoneOffset ofHoursMinutes(int hours, int minutes) { return ofHoursMinutesSeconds(hours, minutes, 0); }
return ofHoursMinutesSeconds(-hours, -minutes, -seconds); } else { return ofHoursMinutesSeconds(hours, minutes, seconds);
return ofHoursMinutesSeconds(-hours, -minutes, -seconds); } else { return ofHoursMinutesSeconds(hours, minutes, seconds);