C# DateTime 最大值

csharpprogrammingserver side programming更新于 2025/9/15 5:57:00

要设置日期的最大值,请使用 DateTime 属性 MaxValue。

DateTime max = DateTime.MaxValue;

现在,显示 max 的值以获取日期的最大值,如下所示。

示例

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

输出

12/31/9999 11:59:59 PM

相关文章