to Year
Returns this year-month with the precision reduced to the year.
Returns this date with the precision reduced to the year.
Returns this date-time with the precision reduced to the 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.
Throws
if parsing fails
if the parsed year is invalid
fun String.toYear(parser: DateTimeParser, settings: DateTimeParserSettings = DateTimeParserSettings.DEFAULT): Year
Content copied to clipboard
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.
Throws
if parsing fails
if the parsed year is invalid