Here you can find the source of formatDate(long millis, String dateFormat)
public static String formatDate(long millis, String dateFormat)
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String formatDate(long millis, String dateFormat) { SimpleDateFormat sdf = new SimpleDateFormat(); if (dateFormat == null) { throw new NullPointerException("Date format cannot be null. Please provide valid date format."); }//from w w w .j a v a2 s .c o m sdf.applyPattern(dateFormat); return sdf.format(new Date(millis)); } }