ParseExactMultiple() static private method

static private ParseExactMultiple ( String s, String formats, DateTimeFormatInfo dtfi, DateTimeStyles style ) : DateTime
s String
formats String
dtfi DateTimeFormatInfo
style DateTimeStyles
return DateTime
Esempio n. 1
0
        public static DateTimeOffset ParseExact(String input, String[] formats, IFormatProvider formatProvider, DateTimeStyles styles)
        {
            styles = ValidateStyles(styles, "styles");
            TimeSpan offset;
            DateTime dateResult = DateTimeParse.ParseExactMultiple(input,
                                                                   formats,
                                                                   DateTimeFormatInfo.GetInstance(formatProvider),
                                                                   styles,
                                                                   out offset);

            return(new DateTimeOffset(dateResult.Ticks, offset));
        }
Esempio n. 2
0
        public static DateTimeOffset ParseExact(string input, string[] formats, IFormatProvider?formatProvider, DateTimeStyles styles)
        {
            styles = ValidateStyles(styles, nameof(styles));
            if (input == null)
            {
                ThrowHelper.ThrowArgumentNullException(ExceptionArgument.input);
            }

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

            return(new DateTimeOffset(dateResult.Ticks, offset));
        }
Esempio n. 3
0
        public static DateTimeOffset ParseExact(String input, String[] formats, IFormatProvider formatProvider, DateTimeStyles styles)
        {
            styles = ValidateStyles(styles, nameof(styles));
            if (input == null)
            {
                ThrowHelper.ThrowArgumentNullException(ExceptionArgument.index);                // TODO: index => input
            }
            TimeSpan offset;
            DateTime dateResult = DateTimeParse.ParseExactMultiple(input.AsReadOnlySpan(),
                                                                   formats,
                                                                   DateTimeFormatInfo.GetInstance(formatProvider),
                                                                   styles,
                                                                   out offset);

            return(new DateTimeOffset(dateResult.Ticks, offset));
        }
Esempio n. 4
0
 public static DateTime ParseExact(String s, String[] formats, IFormatProvider provider, DateTimeStyles style)
 {
     DateTimeFormatInfo.ValidateStyles(style, "style");
     return(DateTimeParse.ParseExactMultiple(s, formats, DateTimeFormatInfo.GetInstance(provider), style));
 }