Duration.Years Property

Definition

Get the years value of this Duration as an int or 0 if not present.

public virtual int Years { [Android.Runtime.Register("getYears", "()I", "GetGetYearsHandler")] get; }
[<get: Android.Runtime.Register("getYears", "()I", "GetGetYearsHandler")>]
member this.Years : int

Property Value

If the years field is present, return its value as an int, else return 0.

Attributes

Remarks

Get the years value of this Duration as an int or 0 if not present.

getYears() is a convenience method for #getField(DatatypeConstants.Field field) getField(DatatypeConstants.YEARS).

As the return value is an int, an incorrect value will be returned for Durations with years that go beyond the range of an int. Use #getField(DatatypeConstants.Field field) getField(DatatypeConstants.YEARS) to avoid possible loss of precision.

Java documentation for javax.xml.datatype.Duration.getYears().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to