tags:

views:

2143

answers:

5

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 :)

+5  A: 

You can see here http://msdn.microsoft.com/en-us/library/system.iformatprovider.aspx

See the remarks and example section there.

Aamir
+2  A: 

Check http://msdn.microsoft.com/en-us/library/system.iformatprovider.aspx for the API.

tehvan
+1  A: 

The DateTimeFormatInfo class implements this interface, so it allows you to control the formatting of your DateTime strings.

Gerrie Schenck
+1  A: 

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.

Raithlin
A: 

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);
Andrei Rinea