どうも、ちょげ(@chogetarou)です。
DateTimeの最大値を取得する方法を紹介します。
方法
DateTimeの最大値を取得するには、MaxValueプロパティを使います。
具体的には、DateTime.MaxValue
のように、DateTimeのMaxValueプロパティにアクセスします。
DateTime maxDate = DateTime.MaxValue;
上記のMaxvalueプロパティは、DateTimeの最大値を取得します。
使用例
using System;
public class Example
{
public static void Main()
{
DateTime maxDate = DateTime.MaxValue;
Console.WriteLine(maxDate);
}
}
出力:
12/31/9999 11:59:59 PM
コメント