クラス
java.time.Periodの使用
パッケージ | 説明 |
---|---|
java.time |
日付、時間、インスタント、デュレーションのメインAPI。
|
java.time.chrono |
デフォルトのISO暦以外の暦体系の汎用API。
|
java.time.format |
日付と時間を出力し、解析するクラスを提供します。
|
-
java.timeでのPeriodの使用
Periodを返すjava.timeのメソッド 修飾子と型 メソッド 説明 static Period
Period. between(LocalDate startDateInclusive, LocalDate endDateExclusive)
2つの日付間の年数、月数、および日数で構成されるPeriod
を取得します。static Period
Period. from(TemporalAmount amount)
時間的な量からPeriod
のインスタンスを取得します。Period
Period. minus(TemporalAmount amountToSubtract)
指定された期間を減算して、この期間のコピーを返します。Period
Period. minusDays(long daysToSubtract)
指定された日数を減算して、この期間のコピーを返します。Period
Period. minusMonths(long monthsToSubtract)
指定された月数を減算して、この期間のコピーを返します。Period
Period. minusYears(long yearsToSubtract)
指定された年数を減算して、この期間のコピーを返します。Period
Period. multipliedBy(int scalar)
この期間の各要素に指定されたスカラーを掛けて、新しいインスタンスを返します。Period
Period. negated()
この期間の各量を否定した、新しいインスタンスを返します。Period
Period. normalized()
その年数および月数を正規化して、この期間のコピーを返します。static Period
Period. of(int years, int months, int days)
年数、月数、および日数を表すPeriod
を取得します。static Period
Period. ofDays(int days)
日数を表すPeriod
を取得します。static Period
Period. ofMonths(int months)
月数を表すPeriod
を取得します。static Period
Period. ofWeeks(int weeks)
週数を表すPeriod
を取得します。static Period
Period. ofYears(int years)
年数を表すPeriod
を取得します。static Period
Period. parse(CharSequence text)
PnYnMnD
などのテキスト文字列からPeriod
を取得します。Period
Period. plus(TemporalAmount amountToAdd)
この期間のコピーに指定された期間を追加したものを返します。Period
Period. plusDays(long daysToAdd)
指定された日数を加算して、この期間のコピーを返します。Period
Period. plusMonths(long monthsToAdd)
指定された月数を加算して、この期間のコピーを返します。Period
Period. plusYears(long yearsToAdd)
指定された年数を加算して、この期間のコピーを返します。Period
LocalDate. until(ChronoLocalDate endDateExclusive)
この日付からもう一方の日付までの期間をPeriod
として計算します。Period
Period. withDays(int days)
指定された日数を使って、この期間のコピーを返します。Period
Period. withMonths(int months)
指定された月数を使って、この期間のコピーを返します。Period
Period. withYears(int years)
指定された年数を使って、この期間のコピーを返します。 -
java.time.chronoでのPeriodの使用
Periodを返すjava.time.chronoのメソッド 修飾子と型 メソッド 説明 Period
IsoChronology. period(int years, int months, int days)
この暦の期間を年、月および日に基づいて取得します。 -
java.time.formatでのPeriodの使用
Period型の引数を持つ型を返すjava.time.formatのメソッド 修飾子と型 メソッド 説明 static TemporalQuery<Period>
DateTimeFormatter. parsedExcessDays()
解析された超過日数へのアクセスを提供する問合せ。