C# DateTime Parse(String, IFormatProvider)
Description
DateTime Parse(String, IFormatProvider)
converts
the string representation of a date and time to its DateTime equivalent by
using culture-specific format information.
Syntax
DateTime.Parse(String, IFormatProvider)
has the following syntax.
public static DateTime Parse(
string s,
IFormatProvider provider
)
Parameters
DateTime.Parse(String, IFormatProvider)
has the following parameters.
s
- A string that contains a date and time to convert.provider
- An object that supplies culture-specific format information about s.
Returns
DateTime.Parse(String, IFormatProvider)
method returns An object that is equivalent to the date and time contained in s as specified
by provider.
Example
The following code shows how to use DateTime.Parse(String, IFormatProvider)
method.
/*w w w. ja v a 2 s .c om*/
using System;
using System.Globalization;
public class IsLeapYear
{
public static void Main()
{
DateTime dt = DateTime.Parse("2012/09/17",CultureInfo.InvariantCulture);
Console.WriteLine(dt);
}
}
The code above generates the following result.