コード例 #1
0
        private static bool TryParseMicrosoftDate(StringReference text, out long ticks, out TimeSpan offset, out DateTimeKind kind)
        {
            kind = DateTimeKind.Utc;

            int index = text.IndexOf('+', 7, text.Length - 8);

            if (index == -1)
            {
                index = text.IndexOf('-', 7, text.Length - 8);
            }

            if (index != -1)
            {
                kind = DateTimeKind.Local;

                if (!TryReadOffset(text, index + text.StartIndex, out offset))
                {
                    ticks = 0;
                    return(false);
                }
            }
            else
            {
                offset = TimeSpan.Zero;
                index  = text.Length - 2;
            }

            return(ConvertUtils.Int64TryParse(text.Chars, 6 + text.StartIndex, index - 6, out ticks) == ParseResult.Success);
        }