c# new datetime code example
Example 1: c# set datetime
var date1 = new DateTime(2008, 5, 1, 8, 30, 52);
Console.WriteLine(date1);
Example 2: import time C#
using system.Threading //Thread.sleep
Example 3: c# datetime
var dat1 = new DateTime();
// The following method call displays 1/1/0001 12:00:00 AM.
Console.WriteLine(dat1.ToString(System.Globalization.CultureInfo.InvariantCulture));
// The following method call displays True.
Console.WriteLine(dat1.Equals(DateTime.MinValue));
Example 4: instantiate date time variable C#
DateTime dtDate = new DateTime(2020,1,1);