DatePeriod

class DatePeriod : DateTimePeriod

A special case of DateTimePeriod that only stores date components and has all time components equal to zero.

A DatePeriod is automatically returned from all constructor functions for DateTimePeriod if it turns out that the time components are zero.

DatePeriod values are used in operations on LocalDates and are returned from operations on LocalDates, but they also can be passed anywhere a DateTimePeriod is expected.

Constructors

Link copied to clipboard
fun DatePeriod(    years: Int = 0,     months: Int = 0,     days: Int = 0)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open override fun toString(): String

Converts this period to the ISO-8601 string representation for durations.

Properties

Link copied to clipboard
open override val days: Int

The number of calendar days.

Link copied to clipboard
open override val hours: Int

The number of whole hours in this period. Always equal to zero.

Link copied to clipboard
open override val minutes: Int

The number of whole minutes in this period. Always equal to zero.

Link copied to clipboard
val months: Int

The number of months in this period that don't form a whole year, so this value is always in (-11..11).

Link copied to clipboard
open override val nanoseconds: Int

The number of nanoseconds in this period. Always equal to zero.

Link copied to clipboard
open override val seconds: Int

The number of whole seconds in this period. Always equal to zero.

Link copied to clipboard
val years: Int

The number of whole years.

Extensions

Link copied to clipboard
operator fun DatePeriod.plus(other: DatePeriod): DatePeriod

Adds two DatePeriod instances.

Link copied to clipboard
fun DatePeriod.toJavaPeriod(): Period

Converts this kotlinx.datetime.DatePeriod value to a java.time.Period value.