ParseRFC1123DateTime() 공개 정적인 메소드

public static ParseRFC1123DateTime ( string dateTimeStr ) : System.DateTime
dateTimeStr string
리턴 System.DateTime
예제 #1
0
        public static object ParseQuotedPrimitive(string value)
        {
            var fn = JsConfig.ParsePrimitiveFn;

            if (fn != null)
            {
                var result = fn(value);
                if (result != null)
                {
                    return(result);
                }
            }

            if (string.IsNullOrEmpty(value))
            {
                return(null);
            }

            Guid guidValue;

            if (Guid.TryParse(value, out guidValue))
            {
                return(guidValue);
            }

            if (value.StartsWith(DateTimeSerializer.EscapedWcfJsonPrefix, StringComparison.Ordinal) || value.StartsWith(DateTimeSerializer.WcfJsonPrefix, StringComparison.Ordinal))
            {
                return(DateTimeSerializer.ParseWcfJsonDate(value));
            }

            if (JsConfig.DateHandler == DateHandler.ISO8601)
            {
                // check that we have UTC ISO8601 date:
                // YYYY-MM-DDThh:mm:ssZ
                // YYYY-MM-DDThh:mm:ss+02:00
                // YYYY-MM-DDThh:mm:ss-02:00
                if (value.Length > 14 && value[10] == 'T' &&
                    (value.EndsWithInvariant("Z") ||
                     value[value.Length - 6] == '+' ||
                     value[value.Length - 6] == '-'))
                {
                    return(DateTimeSerializer.ParseShortestXsdDateTime(value));
                }
            }

            if (JsConfig.DateHandler == DateHandler.RFC1123)
            {
                // check that we have RFC1123 date:
                // ddd, dd MMM yyyy HH:mm:ss GMT
                if (value.Length == 29 && (value.EndsWithInvariant("GMT")))
                {
                    return(DateTimeSerializer.ParseRFC1123DateTime(value));
                }
            }

            return(Serializer.UnescapeString(value));
        }