C# DateTime Max Value

CsharpProgrammingServer Side Programming

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
raja
Published on 12-Sep-2018 12:12:15
Advertisements