toYear

Returns this year-month with the precision reduced to the year.

fun YearMonth.toYear(): Year

Returns this date with the precision reduced to the year.

fun Date.toYear(): Year

Returns this date-time with the precision reduced to the year.

fun DateTime.toYear(): Year
fun OffsetDateTime.toYear(): Year
fun ZonedDateTime.toYear(): Year

Converts a string to a Year.

The string is assumed to be an ISO-8601 year. For example, 2010, +002010, or Y12345. The output of Year.toString can be safely parsed using this method.

fun String.toYear(): Year

Converts a string to a Year using a specific parser.

A set of predefined parsers can be found in DateTimeParsers.

The parser must be capable of supplying DateTimeField.YEAR.

fun String.toYear(parser: DateTimeParser, settings: DateTimeParserSettings): Year