toLocalDateTime

fun String.toLocalDateTime(format: String? = null): LocalDateTime?

Works off of String representations of datetime and tries parsing as LocalDateTime & return null if it fails.

Return

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

Parameters

this

String representation of LocalDateTime.

format

String representing format that should solely be used when parsing the date.