Here you can find the source of toString(LocalDateTime ldt, DateTimeFormatter formatter)
public static String toString(LocalDateTime ldt, DateTimeFormatter formatter)
//package com.java2s; //License from project: Open Source License import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; public class Main { public static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"); public static String toString(LocalDateTime ldt) { return toString(ldt, DATE_TIME_FORMATTER); }//from ww w . ja v a 2 s. co m public static String toString(LocalDateTime ldt, DateTimeFormatter formatter) { return ldt == null ? "" : ldt.format(formatter); } }