Here you can find the source of getCurDateBefore(long time)
public static String getCurDateBefore(long time)
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Date; public class Main { /** The Constant YYYY_MM_DD_HH_MM_SS. */ public static final String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss"; public static String getCurDateBefore(long time) { SimpleDateFormat sdf = new SimpleDateFormat(YYYY_MM_DD_HH_MM_SS); return sdf.format(new Date().getTime() - time); }//from www. ja v a 2s . co m }