Language

Period.WithMonths(Int32) Method

Definition

Returns a copy of this period with the specified amount of months.

[Android.Runtime.Register("withMonths", "(I)Ljava/time/Period;", "", ApiSince=26)]
public Java.Time.Period? WithMonths(int months);
[<Android.Runtime.Register("withMonths", "(I)Ljava/time/Period;", "", ApiSince=26)>]
member this.WithMonths : int -> Java.Time.Period

Parameters

months
Int32

the months to represent, may be negative

Returns

a Period based on this period with the requested months, not null

Attributes

Remarks

Returns a copy of this period with the specified amount of months. This sets the amount of the months unit in a copy of this period. The years and days units are unaffected. The months unit is not automatically normalized with the years unit. This means that a period of "15 months" is different to a period of "1 year and 3 months". This instance is immutable and unaffected by this method call.

Java reference for java.time.Period.withMonths.

Applies to