TryParseExactMultiple() static private method

static private TryParseExactMultiple ( String s, String formats, DateTimeFormatInfo dtfi, DateTimeStyles style, DateTime &result ) : bool
s String
formats String
dtfi DateTimeFormatInfo
style DateTimeStyles
result DateTime
return bool
Example #1
0
        public static bool TryParseExact(
            ReadOnlySpan <char> input, [NotNullWhen(true)] string?[]?formats, IFormatProvider?formatProvider, DateTimeStyles styles, out DateTimeOffset result)
        {
            styles = ValidateStyles(styles, nameof(styles));
            bool parsed = DateTimeParse.TryParseExactMultiple(input, formats, DateTimeFormatInfo.GetInstance(formatProvider), styles, out DateTime dateResult, out TimeSpan offset);

            result = new DateTimeOffset(dateResult.Ticks, offset);
            return(parsed);
        }
Example #2
0
        public static bool TryParseExact(string input, string[] formats, IFormatProvider formatProvider, DateTimeStyles styles, out DateTimeOffset result)
        {
            TimeSpan span;

            System.DateTime time;
            styles = ValidateStyles(styles, "styles");
            bool flag = DateTimeParse.TryParseExactMultiple(input, formats, DateTimeFormatInfo.GetInstance(formatProvider), styles, out time, out span);

            result = new DateTimeOffset(time.Ticks, span);
            return(flag);
        }
Example #3
0
        public static Boolean TryParseExact(String input, String[] formats, IFormatProvider formatProvider, DateTimeStyles styles,
                                            out DateTimeOffset result)
        {
            styles = ValidateStyles(styles, "styles");
            TimeSpan offset;
            DateTime dateResult;
            Boolean  parsed = DateTimeParse.TryParseExactMultiple(input,
                                                                  formats,
                                                                  DateTimeFormatInfo.GetInstance(formatProvider),
                                                                  styles,
                                                                  out dateResult,
                                                                  out offset);

            result = new DateTimeOffset(dateResult.Ticks, offset);
            return(parsed);
        }
Example #4
0
        public static bool TryParseExact(string?input, string?[]?formats, IFormatProvider?formatProvider, DateTimeStyles styles,
                                         out DateTimeOffset result)
        {
            styles = ValidateStyles(styles, nameof(styles));
            if (input == null)
            {
                result = default;
                return(false);
            }

            bool parsed = DateTimeParse.TryParseExactMultiple(input,
                                                              formats,
                                                              DateTimeFormatInfo.GetInstance(formatProvider),
                                                              styles,
                                                              out DateTime dateResult,
                                                              out TimeSpan offset);

            result = new DateTimeOffset(dateResult.Ticks, offset);
            return(parsed);
        }
Example #5
0
        public static Boolean TryParseExact(String input, String[] formats, IFormatProvider formatProvider, DateTimeStyles styles,
                                            out DateTimeOffset result)
        {
            styles = ValidateStyles(styles, nameof(styles));
            if (input == null)
            {
                result = default(DateTimeOffset);
                return(false);
            }

            TimeSpan offset;
            DateTime dateResult;
            Boolean  parsed = DateTimeParse.TryParseExactMultiple(input.AsReadOnlySpan(),
                                                                  formats,
                                                                  DateTimeFormatInfo.GetInstance(formatProvider),
                                                                  styles,
                                                                  out dateResult,
                                                                  out offset);

            result = new DateTimeOffset(dateResult.Ticks, offset);
            return(parsed);
        }
Example #6
0
 public static bool TryParseExact(string s, string[] formats, IFormatProvider provider, DateTimeStyles style, out DateTime result)
 {
     DateTimeFormatInfo.ValidateStyles(style, "style");
     return(DateTimeParse.TryParseExactMultiple(s, formats, DateTimeFormatInfo.GetInstance(provider), style, out result));
 }