private static Integer parseTzOffsetMs ( Input s , boolean strict ) { if ( s . index < s . len ) { char c = s . getChar ( ) ; s . index ++ ; int sign ; if ( c == ' ' ) { return 0 ; } else if ( c == ' ' ) { sign = 1 ; } else if ( c == ' ' ) { sign = - 1 ; } else { throw new DateFormatException ( "unexpected character, expected one of [Z+-]" , s . str , s . index - 1 ) ; } int tzHours = parseField ( "timezone hours" , s , TIME_SEP , 2 , 2 , strict ) ; if ( strict && tzHours > 14 ) throw new DateFormatException ( "timezone offset hours out of range [0..14]" , s . str , s . index - 2 ) ; int tzMin = parseField ( "timezone minutes" , s , null , 2 , 2 , strict ) ; if ( strict && tzMin > 59 ) throw new DateFormatException ( "timezone offset hours out of range [0..59]" , s . str , s . index - 1 ) ; if ( strict && tzHours == 14 && tzMin > 0 ) throw new DateFormatException ( "timezone offset may not be greater than 14 hours" , s . str , s . index - 1 ) ; return sign * ( tzHours * MINS_IN_HOUR + tzMin ) * MS_IN_MIN ; } // Reached the end of input with no timezone specified. return null ; }
Parse the timezone offset from the input returning its millisecond value .