new datetime c# code example
Example 1: c# date
using System;
class Test {
static void Main() {
Console.WriteLine (DateTime.Now.ToString());
DateTime dt = new DateTime(2018, 7, 24);
Console.WriteLine (dt.ToString());
}
}
Example 2: import time C#
using system.Threading
Example 3: c# datetime
var dat1 = new DateTime();
Console.WriteLine(dat1.ToString(System.Globalization.CultureInfo.InvariantCulture));
Console.WriteLine(dat1.Equals(DateTime.MinValue));
Example 4: datetitime contrusctor c#
public struct DateTime : IComparable, IComparable<DateTime>, IConvertible, IEquatable<DateTime>, IFormattable, System.Runtime.Serialization.ISerializable
Example 5: instantiate date time variable C#
DateTime dtDate = new DateTime(2020,1,1);