Esempio n. 1
0
        public void TryParseExact_Test(string input, string format, bool expectedParsed, DateTimeUtc expectedResult)
        {
            var parsed = DateTimeUtc.TryParseExact(input, new[] { format }, DateTimeFormatInfo.InvariantInfo, out var result);

            Assert.Equal(expectedParsed, parsed);
            Assert.Equal(expectedResult, result);
        }
Esempio n. 2
0
        public static DateTimeUtc DateTimeParse(string input)
        {
            var formats = new[] {
                "ddd MMM dd HH:mm:ss zzzz yyyy",
                "ddd, d MMM yyyy HH:mm:ss zzzz",
            };

            if (DateTimeUtc.TryParseExact(input, formats, DateTimeFormatInfo.InvariantInfo, out var result))
            {
                return(result);
            }

            TraceOut("Parse Error(DateTimeFormat) : " + input);

            return(DateTimeUtc.Now);
        }