datetime date = new datetime() in c# code example
Example 1: c# date
using System;
class Test {
static void Main() {
//print current datetime
Console.WriteLine (DateTime.Now.ToString());
//make a custom datetime
DateTime dt = new DateTime(2018, 7, 24);
Console.WriteLine (dt.ToString());
}
}
Example 2: 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));