KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I don't understand Why there is an overload with IFormatProvider in DateTime.ParseExact ? If I'm defining exactly how it should be parsed ( spaces , separators etc ) , then theres should be no problem : All these 3 examples show the same result: example 1 CultureInfo provider =CultureInfo.CreateSpecificCulture("en-US"); var t= DateTime.ParseExact("13-2-2013", "d-M-yyyy", provider, DateTimeStyles.None); Console.WriteLine (t); //13/02/2013 00:00:00 example 2 CultureInfo provider =CultureInfo.CreateSpecificCulture("en-US"); var t= DateTime.ParseExact("13/2/2013", "d/M/yyyy", provider, DateTimeStyles.None); Console.WriteLine (t); //13/02/2013 00:00:00 example 3 CultureInfo provider =CultureInfo.CreateSpecificCulture("en-US"); var t= DateTime.ParseExact("13@@@2@@@2013", "d@@@M@@@yyyy", provider, DateTimeStyles.None); Console.WriteLine (t); //13/02/2013 00:00:00 So why do i need to provide provider If I'm explicitly defining the structure ?
Tags (comma-separated)
Save Edits
Cancel