Here you can find the source of formatTime(LocalDateTime dateTime)
public static String formatTime(LocalDateTime dateTime)
//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 FORMAT_TIME = "hh:mm a"; public static String formatTime(LocalDateTime dateTime) { DateTimeFormatter formatter = DateTimeFormatter.ofPattern(FORMAT_TIME); return dateTime.format(formatter); }/* w ww . j a v a 2s .co m*/ }