Javatime-localdate-until1
提供:Dev Guides
java.time.LocalDate.until()メソッドの例
説明
- java.time.LocalDate.until(Temporal endExclusive、TemporalUnit unit)*メソッドは、指定された単位で別の日付までの時間を計算します。
宣言
以下は、* java.time.LocalDate.until(Temporal endExclusive、TemporalUnit unit)*メソッドの宣言です。
パラメーター
- endDateExclusive -終了日、排他的、nullではなくLocalDateに変換されます。
- unit -金額を測定する単位、null以外。
戻り値
この日付から終了日までの時間。
例外
- DateTimeException -金額を計算できない場合、または終了時間をLocalDateに変換できない場合
- UnsupportedTemporalTypeException -ユニットがサポートされていない場合。
- ArithmeticException -数値オーバーフローが発生した場合。
例
次の例は、java.time.LocalDate.until(Temporal endExclusive、TemporalUnit unit)メソッドの使用方法を示しています。
上記のプログラムをコンパイルして実行すると、次の結果が生成されます-