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.