The cleanest way to do this is not to use LocalDate::from
at all, but to call LocalDate/parse
directly and pass the DateTimeFormatter
as an argument:
(java.time.LocalDate/parse
"2016-11-08T18:24:25Z"
java.time.format.DateTimeFormatter/ISO_DATE_TIME)
;=> #object[java.time.LocalDate 0x16cddb1f "2016-11-08"]
(I found this searching for the best way to use java.time.format.DateTimeFormatter
from Clojure, so I decided to record the solution here. It doesn’t answer the question as it was asked, but it will be useful for other searchers.)