Here you can find the source of formatDate(long milli)
public static String formatDate(long milli)
//package com.java2s; //License from project: Mozilla Public License import java.time.Instant; import java.time.ZoneOffset; import java.time.format.DateTimeFormatter; public class Main { private static final ZoneOffset ZERO = ZoneOffset.ofTotalSeconds(0); public static String formatDate(long milli) { return DateTimeFormatter.ISO_LOCAL_DATE.format(Instant.ofEpochMilli(milli).atOffset(ZERO)); }/* w w w . j av a 2 s .c o m*/ public static String format(long milli) { return DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(Instant.ofEpochMilli(milli).atOffset(ZERO)); } }