core-ktx / androidx.time / java.time.Period / component1

component1

inline operator fun Period.component1(): Int

Return the years component of this Period.

This method allows to use destructuring declarations when working with periods, for example:

val (years, months, days) = myPeriod

See Also

Period.getYears