Java tutorial
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; public class Main { private static final String DEFAULT_FORMAT = "yyyy-MM-dd HH:mm:ss"; /** * Get String time by long. {@link FTimeUtil#DEFAULT_FORMAT} * * @param timeInMillis * @return */ public static String getTime(long timeInMillis) { return getTime(timeInMillis, DEFAULT_FORMAT); } /** * Get String time by long. * * @param timeInMillis * @param format use format from FDataUtil. {@link FTimeUtil#FORMAT_1} * @return */ public static String getTime(long timeInMillis, String format) { SimpleDateFormat df = new SimpleDateFormat(format); return df.format(new Date(timeInMillis)); } }