_calendar.set(Calendar.SECOND, checkAndCastSecond(zsecond)); case MINUTE: _calendar.set(Calendar.MINUTE, checkAndCastMinute(zminute));
this._second = checkAndCastSecond(cal.get(Calendar.SECOND)); if (calendarHasMilliseconds) { BigDecimal millis = BigDecimal.valueOf(cal.get(Calendar.MILLISECOND));
this._second = checkAndCastSecond(cal.get(Calendar.SECOND)); if (calendarHasMilliseconds) { BigDecimal millis = BigDecimal.valueOf(cal.get(Calendar.MILLISECOND));
_second = checkAndCastSecond(zsecond); case MINUTE: _minute = checkAndCastMinute(zminute);
/** * This method uses deprecated methods from {@link java.util.Date} * instead of {@link Calendar} so that this code can be used (more easily) * on the mobile Java platform (which has Date but does not have Calendar). */ @SuppressWarnings("deprecation") private void set_fields_from_millis(long millis) { if(millis < MINIMUM_ALLOWED_TIMESTAMP_IN_MILLIS){ throw new IllegalArgumentException("year is less than 1"); } Date date = new Date(millis); // These fields are in the system timezone! this._year = checkAndCastYear(date.getYear() + 1900); this._month = checkAndCastMonth(date.getMonth() + 1); // calendar months are 0 based, timestamp months are 1 based this._day = checkAndCastDay(date.getDate(), _year, _month); this._hour = checkAndCastHour(date.getHours()); this._minute = checkAndCastMinute(date.getMinutes()); this._second = checkAndCastSecond(date.getSeconds()); // this is done because the y-m-d values are in the local timezone // so this adjusts the value back to zulu time (UTC) // Note that the sign on this is opposite of Ion (and Calendar) offset. // Example: PST = 480 here but Ion/Calendar use -480 = -08:00 = UTC-8 int offset = date.getTimezoneOffset(); this.apply_offset(-offset); }
_second = checkAndCastSecond(zsecond); case MINUTE: _minute = checkAndCastMinute(zminute);
/** * This method uses deprecated methods from {@link java.util.Date} * instead of {@link Calendar} so that this code can be used (more easily) * on the mobile Java platform (which has Date but does not have Calendar). */ @SuppressWarnings("deprecation") private void set_fields_from_millis(long millis) { Date date = new Date(millis); // These fields are in the system timezone! this._year = checkAndCastYear(date.getYear() + 1900); this._month = checkAndCastMonth(date.getMonth() + 1); // calendar months are 0 based, timestamp months are 1 based this._day = checkAndCastDay(date.getDate(), _year, _month); this._hour = checkAndCastHour(date.getHours()); this._minute = checkAndCastMinute(date.getMinutes()); this._second = checkAndCastSecond(date.getSeconds()); // this is done because the y-m-d values are in the local timezone // so this adjusts the value back to zulu time (UTC) // Note that the sign on this is opposite of Ion (and Calendar) offset. // Example: PST = 480 here but Ion/Calendar use -480 = -08:00 = UTC-8 int offset = date.getTimezoneOffset(); this.apply_offset(-offset); }