month
Returns the month (Month) component of the date.
Samples
import kotlinx.datetime.*
import kotlinx.datetime.format.*
import kotlin.test.*
fun main() {
//sampleStart
// Accessing the date components of a LocalDateTime value
val date = LocalDate(2024, 2, 15)
val time = LocalTime(hour = 16, minute = 48, second = 59, nanosecond = 999_999_999)
val dateTime = LocalDateTime(date, time)
check(dateTime.year == dateTime.date.year)
check(dateTime.month == dateTime.date.month)
check(dateTime.monthNumber == dateTime.date.monthNumber)
check(dateTime.dayOfMonth == dateTime.date.dayOfMonth)
check(dateTime.dayOfWeek == dateTime.date.dayOfWeek)
check(dateTime.dayOfYear == dateTime.date.dayOfYear)
//sampleEnd
}