I was playing around with the Datetime.ParseExact method, and it wants an iformatprovider..
It works inputting null, but what exactly does it do?
Thanks :)
-
You can see here http://msdn.microsoft.com/en-us/library/system.iformatprovider.aspx
See the remarks and example section there.
-
Check http://msdn.microsoft.com/en-us/library/system.iformatprovider.aspx for the API.
-
The DateTimeFormatInfo class implements this interface, so it allows you to control the formatting of your DateTime strings.
-
IFormatProvider provides culture info to the method in question. DateTimeFormatInfo implements IFormatProvider, and allows you to specify the format you want your date/time to be displayed in. Examples can be found on the relevant MSDN pages.
-
Also CultureInfo implements this interface and can be used in your case. So you could parse a French date string for example; you could use
var ci = new CultureInfo("fr-FR"); DateTime dt = DateTime.Parse(yourDateInputString, yourFormatString, ci);
0 comments:
Post a Comment