toYearMonth

fun String.toYearMonth(vararg formats: String?): YearMonth?

Works off of String representations of YearMonth (ISO default: "2024-11"). When formats are provided, each format is attempted in-order until one succeeds.

Return

YearMonth? Null means couldn't parse, else parsed YearMonth.

Parameters

this

String representation of YearMonth.

formats

String? vararg of formats to attempt when parsing.