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