Here you can find the source of Date2StringSec(Date date)
public static String Date2StringSec(Date date)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.*; public class Main { public final static String DefaultLongFormat = "yyyy-MM-dd HH:mm:ss"; public static String Date2StringSec(Date date) { SimpleDateFormat formatter = new SimpleDateFormat(DefaultLongFormat); return formatter.format(date); }//ww w . j a v a 2s . c om public static String Date2StringSec(Integer seconds) { return Date2StringSec(fromUnixTime(seconds)); } public static Date fromUnixTime(Integer seconds) { return new Date(seconds * 1000L); } public static Date fromUnixTime(Long millis) { return new Date(millis); } }