private BaseDateTimeDt setTimeZone(String theWholeValue, String theValue) { if (isBlank(theValue)) { throwBadDateFormat(theWholeValue); } else if (theValue.charAt(0) == 'Z') { clearTimeZone(); setTimeZoneZulu(true); } else if (theValue.length() != 6) { throwBadDateFormat(theWholeValue, "Timezone offset must be in the form \"Z\", \"-HH:mm\", or \"+HH:mm\""); } else if (theValue.charAt(3) != ':' || !(theValue.charAt(0) == '+' || theValue.charAt(0) == '-')) { throwBadDateFormat(theWholeValue, "Timezone offset must be in the form \"Z\", \"-HH:mm\", or \"+HH:mm\""); } else { parseInt(theWholeValue, theValue.substring(1, 3), 0, 23); parseInt(theWholeValue, theValue.substring(4, 6), 0, 59); clearTimeZone(); setTimeZone(TimeZone.getTimeZone("GMT" + theValue)); } return this; }
cal.set(Calendar.YEAR, parseInt(value, value.substring(0, 4), 0, 9999)); precision = TemporalPrecisionEnum.YEAR; if (length > 4) { validateCharAtIndexIs(value, 4, '-'); validateLengthIsAtLeast(value, 7); int monthVal = parseInt(value, value.substring(5, 7), 1, 12) - 1; cal.set(Calendar.MONTH, monthVal); precision = TemporalPrecisionEnum.MONTH; cal.set(Calendar.DATE, 1); // for some reason getActualMaximum works incorrectly if date isn't set int actualMaximum = cal.getActualMaximum(Calendar.DAY_OF_MONTH); cal.set(Calendar.DAY_OF_MONTH, parseInt(value, value.substring(8, 10), 1, actualMaximum)); precision = TemporalPrecisionEnum.DAY; if (length > 10) { cal.set(Calendar.HOUR_OF_DAY, parseInt(value, value.substring(11, 13), 0, 23)); cal.set(Calendar.MINUTE, parseInt(value, value.substring(14, 16), 0, 59)); precision = TemporalPrecisionEnum.MINUTE; if (timeLength > 5) { validateLengthIsAtLeast(value, 19); validateCharAtIndexIs(value, 16, ':'); // yyyy-mm-ddThh:mm:ss cal.set(Calendar.SECOND, parseInt(value, value.substring(17, 19), 0, 59)); precision = TemporalPrecisionEnum.SECOND; if (timeLength > 8) { endIndex = 23; millisString = value.substring(20, endIndex); millis = parseInt(value, millisString, 0, 999); } else {
private BaseDateTimeDt setTimeZone(String theWholeValue, String theValue) { if (isBlank(theValue)) { throwBadDateFormat(theWholeValue); } else if (theValue.charAt(0) == 'Z') { clearTimeZone(); setTimeZoneZulu(true); } else if (theValue.length() != 6) { throwBadDateFormat(theWholeValue, "Timezone offset must be in the form \"Z\", \"-HH:mm\", or \"+HH:mm\""); } else if (theValue.charAt(3) != ':' || !(theValue.charAt(0) == '+' || theValue.charAt(0) == '-')) { throwBadDateFormat(theWholeValue, "Timezone offset must be in the form \"Z\", \"-HH:mm\", or \"+HH:mm\""); } else { parseInt(theWholeValue, theValue.substring(1, 3), 0, 23); parseInt(theWholeValue, theValue.substring(4, 6), 0, 59); clearTimeZone(); setTimeZone(TimeZone.getTimeZone("GMT" + theValue)); } return this; }
cal.set(Calendar.YEAR, parseInt(value, value.substring(0, 4), 0, 9999)); precision = TemporalPrecisionEnum.YEAR; if (length > 4) { validateCharAtIndexIs(value, 4, '-'); validateLengthIsAtLeast(value, 7); int monthVal = parseInt(value, value.substring(5, 7), 1, 12) - 1; cal.set(Calendar.MONTH, monthVal); precision = TemporalPrecisionEnum.MONTH; cal.set(Calendar.DATE, 1); // for some reason getActualMaximum works incorrectly if date isn't set int actualMaximum = cal.getActualMaximum(Calendar.DAY_OF_MONTH); cal.set(Calendar.DAY_OF_MONTH, parseInt(value, value.substring(8, 10), 1, actualMaximum)); precision = TemporalPrecisionEnum.DAY; if (length > 10) { cal.set(Calendar.HOUR_OF_DAY, parseInt(value, value.substring(11, 13), 0, 23)); cal.set(Calendar.MINUTE, parseInt(value, value.substring(14, 16), 0, 59)); precision = TemporalPrecisionEnum.MINUTE; if (timeLength > 5) { validateLengthIsAtLeast(value, 19); validateCharAtIndexIs(value, 16, ':'); // yyyy-mm-ddThh:mm:ss cal.set(Calendar.SECOND, parseInt(value, value.substring(17, 19), 0, 59)); precision = TemporalPrecisionEnum.SECOND; if (timeLength > 8) { endIndex = 23; millisString = value.substring(20, endIndex); millis = parseInt(value, millisString, 0, 999); } else {