Here you can find the source of parseAndFormat(String date, DateTimeFormatter fromFormatter, DateTimeFormatter toFormatter)
public static String parseAndFormat(String date, DateTimeFormatter fromFormatter, DateTimeFormatter toFormatter)
//package com.java2s; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; public class Main { public static String parseAndFormat(String date, DateTimeFormatter fromFormatter, DateTimeFormatter toFormatter) { LocalDateTime localDateTime = LocalDateTime.parse(date, fromFormatter); return localDateTime.format(toFormatter); }/*from w ww . j av a2 s . c o m*/ }