toLocalDateTime

Works off of String representations of date(time) and parses through the following attempts in order when no format is present:

  • First, tries parsing as LocalDateTime, if successful, uses systemTimeZone.
  • Lastly, tries parsing as LocalDate, if successful, adds start of daytime, & systemTimeZone.

When a format is present, tries parsing using that format alone, & return null if it fails.

Return

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

Parameters

this

String representation of either LocalDate, or LocalDateTime.

format

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