Here you can find the source of format(LocalDateTime dateTime)
public static String format(LocalDateTime dateTime)
//package com.java2s; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.time.format.FormatStyle; public class Main { public static String format(LocalDateTime dateTime) { if (dateTime == null) { return null; }//from ww w . j av a 2 s. co m return dateTime.format(DateTimeFormatter.ofLocalizedDateTime(FormatStyle.MEDIUM)); } }