import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* 俩个时间戳相减
* 2015年6月8日10:34:15
* @author cfs
*/
public class testTime {
public static void main(String[] args) throws ParseException {
SimpleDateFormat formatter = new SimpleDateFormat ("yyyyMMdd HH:mm:ss");
Date curDate = new Date(System.currentTimeMillis());//获取当前时间
Date parse = formatter.parse("20150608 10:09:18");
long yy = curDate.getTime() - parse.getTime();
System.out.println(yy/1000/60);//相差多少分钟
//yy/1000:相差多少秒
//yy/1000/60:相差多少分钟
//yy/1000/60/60:相差多少小时
//yy/1000/60/60/24:相差多少天
}
}
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* 俩个时间戳相减
* 2015年6月8日10:34:15
* @author cfs
*/
public class testTime {
public static void main(String[] args) throws ParseException {
SimpleDateFormat formatter = new SimpleDateFormat ("yyyyMMdd HH:mm:ss");
Date curDate = new Date(System.currentTimeMillis());//获取当前时间
Date parse = formatter.parse("20150608 10:09:18");
long yy = curDate.getTime() - parse.getTime();
System.out.println(yy/1000/60);//相差多少分钟
//yy/1000:相差多少秒
//yy/1000/60:相差多少分钟
//yy/1000/60/60:相差多少小时
//yy/1000/60/60/24:相差多少天
}
}