Period.WithYears(Int32) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Returns a copy of this period with the specified amount of years.
[Android.Runtime.Register("withYears", "(I)Ljava/time/Period;", "", ApiSince=26)]
public Java.Time.Period? WithYears(int years);
[<Android.Runtime.Register("withYears", "(I)Ljava/time/Period;", "", ApiSince=26)>]
member this.WithYears : int -> Java.Time.Period
Parameters
- years
- Int32
the years to represent, may be negative
Returns
a Period based on this period with the requested years, not null
- Attributes
Remarks
Returns a copy of this period with the specified amount of years. This sets the amount of the years unit in a copy of this period. The months 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.withYears.