Convert Java Time LocalDateTime To ISO Format

April 11, 2018
FORMATTER = DateTimeFormatter.ISO_LOCAL_DATE_TIME

val now = LocalDateTime.now(ZoneOffset.UTC)
// covert LocalDateTime to ISO Date String
val dateString = FORMATTER.format(now)
// // Output: 2018-04-10T03:34:18.115

// covert ISO Date String to LocalDateTime
val newNow = FORMATTER.parse(dateString, LocalDateTime.FROM)
This work is licensed under a
Creative Commons Attribution-NonCommercial 4.0 International License.