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

 Live Demo

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

Updated on: 23-Jun-2020

4K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements