Here you can find the source of format(LocalDateTime localDateTime, String pattern)
public static String format(LocalDateTime localDateTime, String pattern)
//package com.java2s; //License from project: Open Source License import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; public class Main { public static final String DEFAULT_PATTERN = "yyyy-MM-dd HH:mm:ss"; public static String format(LocalDateTime localDateTime, String pattern) { if (localDateTime == null) { return ""; }/*from w ww .j av a 2s .c o m*/ return DateTimeFormatter.ofPattern(pattern == null ? DEFAULT_PATTERN : pattern).format(localDateTime); } }