using System;
class MainClass
{
public static void Main(string[] args)
{
DateTime dt1 = DateTime.Parse("Sep 2005");
Console.WriteLine(dt1);
DateTime dt2 = DateTime.Parse("Monday 5 September 2005 14:15:33");
Console.WriteLine(dt2);
DateTime dt3 = DateTime.Parse("5, 9,05");
Console.WriteLine(dt3);
DateTime dt4 = DateTime.Parse("5/9/2005 14:15:33");
Console.WriteLine(dt4);
DateTime dt5 = DateTime.Parse("2:15 PM");
Console.WriteLine(dt5);
DateTime dt6 = DateTime.ParseExact("2:13:30 PM", "h:mm:ss tt", null);
Console.WriteLine(dt6);
DateTime dt7 = DateTime.ParseExact("Mon, 05 Sep 2005 14:13:30 GMT","ddd, dd MMM yyyy HH':'mm':'ss 'GMT'", null);
Console.WriteLine(dt7);
DateTime dt8 = DateTime.ParseExact("September 05", "MMMM dd", null);
Console.WriteLine(dt8);
}
}
|