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

component2

inline operator fun Period.component2(): Int

Return the months 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.getMonths