Here you can find the source of toLocalDateTime(String string)
public static LocalDateTime toLocalDateTime(String string)
//package com.java2s; //License from project: Apache License import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatterBuilder; public class Main { public static final DateTimeFormatter FORMATTER = new DateTimeFormatterBuilder().parseCaseInsensitive() .append(DateTimeFormatter.ISO_LOCAL_DATE_TIME).appendLiteral("Z").toFormatter(); public static LocalDateTime toLocalDateTime(String string) { if (string == null) { return null; }//from ww w .j a v a 2 s . com return LocalDateTime.parse(string, FORMATTER); } }