public bool TryReadOffset(StringReference offsetText, int startIndex, out TimeSpan offset) { bool negative = (offsetText.Get(startIndex) == '-'); int hours; if (XConvert.Int32TryParse(offsetText.Chars, startIndex + 1, 2, out hours) != ParseResult.Success) { offset = default(TimeSpan); return(false); } int minutes = 0; if (offsetText.Length - startIndex > 5) { if (XConvert.Int32TryParse(offsetText.Chars, startIndex + 3, 2, out minutes) != ParseResult.Success) { offset = default(TimeSpan); return(false); } } offset = TimeSpan.FromHours(hours) + TimeSpan.FromMinutes(minutes); if (negative) { offset = offset.Negate(); } return(true); }