Here you can find the source of formatDateTime(long d)
public static String formatDateTime(long d)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String DATETIME_FORMAT = "yyyy-MM-dd HH:mm"; /**// w w w. jav a 2 s.c o m * Convert date and time to string like "yyyy-MM-dd HH:mm". */ public static String formatDateTime(Date d) { return new SimpleDateFormat(DATETIME_FORMAT).format(d); } /** * Convert date and time to string like "yyyy-MM-dd HH:mm". */ public static String formatDateTime(long d) { return new SimpleDateFormat(DATETIME_FORMAT).format(d); } }