toLocalDate

fun Calendar.toLocalDate(): LocalDate

Convert Calendar to LocalDate.

Since

1.1.0


fun Date.toLocalDate(): LocalDate

Convert Date to LocalDate.

Since

1.1.0


fun Instant.toLocalDate(timeZone: TimeZone = TimeZone.currentSystemDefault()): LocalDate

Convert Instant to LocalDate.

Since

1.1.0


fun Long.toLocalDate(): LocalDate

Convert Long to LocalDate.

Example:

1659814200000.toLocalDate() // 2022-07-07

Since

1.1.0


fun String.toLocalDate(pattern: String = "EEE MMM dd HH:mm:ss zzz yyyy"): LocalDate

Produce a LocalDate from the given strings value and pattern.

Example:

"8/7/2022".toLocalDate("MM/dd/yyyy") // 2022-07-07
"Sun Aug 07 16:37:42 IRDT 2022".toLocalDate() // 2022-07-07
"7/2022".toLocalDate("MM/dd/yyyy") // ParseException

Since

1.1.0

Return

A LocalDate parsed from the string.

See also

Throws

if the beginning of the specified string cannot be parsed.

IllegalArgumentException

if the given pattern is invalid


fun LocalDateTime.toLocalDate(): LocalDate

Convert LocalDateTime to LocalDate.

Since

1.1.0