Parse string to DateTime by using culture-specific format and formatting style in CSharp
Description
The following code shows how to parse string to DateTime by using culture-specific format and formatting style.
Example
/* w w w . j a va 2 s .c o m*/
using System;
using System.Globalization;
public class IsLeapYear
{
public static void Main()
{
DateTime dt = DateTime.Parse("2012/09/17", CultureInfo.InvariantCulture,DateTimeStyles.AdjustToUniversal );
Console.WriteLine(dt);
}
}
The code above generates the following result.