Here you can find the source of formatDate(long date)
Parameter | Description |
---|---|
date | The date |
public static String formatDate(long date)
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Calendar; public class Main { /**/*from www . j a v a 2 s . com*/ * Returns a formatted date.<br> * The pattern is: yyyy-MM-dd,HH:mm:ss * * @param date * The date * @return The formatted date */ public static String formatDate(long date) { SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd,HH:mm:ss"); Calendar cal = Calendar.getInstance(); cal.setTimeInMillis(date * 1000); return format.format(cal.getTime()); } }