C# DateTime 最大值


若要设置日期的最大值,请使用 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

更新于: 2020 年 6 月 23 日

5K+ 浏览量

开启您的职业生涯

完成课程,获得认证

开始入门
广告
© . All rights reserved.