Computer >> Computer tutorials >  >> Programming >> C#

C# DateTime Max Value


To set the max value for a Date, use the DateTime property MaxValue.

DateTime max = DateTime.MaxValue;

Now, display the value of max to get the maximum value of a date as shown below.

Example

using System;
using System.Linq;
public class Demo {
   public static void Main() {
      DateTime max = DateTime.MaxValue;
      Console.WriteLine(max);
   }
}

Output

12/31/9999 11:59:59 PM