/** * @see CommonTM#setOffset(int) * @throws DataTypeException if the value is incorrectly formatted. If validation is enabled, this * exception should be thrown at setValue(), but if not, detailed parsing may be deferred until * this method is called. */ public void setOffset(int signedOffset) throws DataTypeException { getDetail().setOffset(signedOffset); }
/** * @see CommonTM#setOffset(int) * @throws DataTypeException if the value is incorrectly formatted. If validation is enabled, this * exception should be thrown at setValue(), but if not, detailed parsing may be deferred until * this method is called. */ public void setOffset(int signedOffset) throws DataTypeException { getDetail().setOffset(signedOffset); }
/** * Convenience setter which sets the value using a {@link Calendar} object. Passing in <code>null</code> clears any existing value. * * Note: Sets fields using precision up to the millisecond, including timezone offset * * @param theCalendar The calendar object from which to retrieve values * @since 1.1 */ public void setValue(Calendar theCalendar) throws DataTypeException { if (theCalendar == null) { setValue((String)null); return; } int hr = theCalendar.get(Calendar.HOUR_OF_DAY); int min = theCalendar.get(Calendar.MINUTE); float sec = theCalendar.get(Calendar.SECOND) + (theCalendar.get(Calendar.MILLISECOND) / 1000.0F); setHourMinSecondPrecision(hr, min, sec); // 3410095: care for integer overflow and timezones not at the full hour, e.g. India int hourOffset= theCalendar.get(Calendar.ZONE_OFFSET) / (1000 * 60 * 60); int minuteOffset = (theCalendar.get(Calendar.ZONE_OFFSET) / (1000 * 60)) % 60; int zoneOffset = hourOffset * 100 + minuteOffset; setOffset(zoneOffset); }
/** * Convenience setter which sets the value using a {@link Calendar} object. Passing in <code>null</code> clears any existing value. * * Note: Sets fields using precision up to the millisecond, including timezone offset * * @param theCalendar The calendar object from which to retrieve values * @since 1.1 */ public void setValue(Calendar theCalendar) throws DataTypeException { if (theCalendar == null) { setValue((String)null); return; } int hr = theCalendar.get(Calendar.HOUR_OF_DAY); int min = theCalendar.get(Calendar.MINUTE); float sec = theCalendar.get(Calendar.SECOND) + (theCalendar.get(Calendar.MILLISECOND) / 1000.0F); setHourMinSecondPrecision(hr, min, sec); // 3410095: care for integer overflow and timezones not at the full hour, e.g. India int hourOffset= theCalendar.get(Calendar.ZONE_OFFSET) / (1000 * 60 * 60); int minuteOffset = (theCalendar.get(Calendar.ZONE_OFFSET) / (1000 * 60)) % 60; int zoneOffset = hourOffset * 100 + minuteOffset; setOffset(zoneOffset); }
/** * This method takes in the four digit (signed) GMT offset and sets the offset * field */ public void setOffset(int signedOffset) throws DataTypeException { try { //create new time object is there isn't one if (tm == null) { tm = new CommonTM(); } //set the offset value of the time object to the input value tm.setOffset(signedOffset); } catch (DataTypeException e) { throw e; } //end catch catch (Exception e) { throw new DataTypeException(e); } //end catch } //end method
/** * This method takes in the four digit (signed) GMT offset and sets the offset * field */ public void setOffset(int signedOffset) throws DataTypeException { try { //create new time object is there isn't one if (tm == null) { tm = new CommonTM(); } //set the offset value of the time object to the input value tm.setOffset(signedOffset); } catch (DataTypeException e) { throw e; } //end catch catch (Exception e) { throw new DataTypeException(e); } //end catch } //end method
tm.setOffset(calOffset); val = tm.getValue();
tm.setOffset(calOffset); val = tm.getValue();
tm.setOffset(signedOffset);
tm.setOffset(signedOffset);