Here you can find the source of formatDate(long millisecond, String format)
Parameter | Description |
---|---|
millisecond | a parameter |
format | a parameter |
public static String formatDate(long millisecond, String format)
//package com.java2s; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; public class Main { /**/*from w w w . j a v a 2s. c o m*/ * @param date * @param format * @return String */ public static String formatDate(Date date, String format) { DateFormat dateFormat = new SimpleDateFormat(format); return dateFormat.format(date); } /** * @param millisecond * @param format * @return String */ public static String formatDate(long millisecond, String format) { DateFormat dateFormat = new SimpleDateFormat(format); Date date = new Date(millisecond); return dateFormat.format(date); } }