publicstaticStringgetDatePoor(Date endDate,Date nowDate){longnd=1000*24*60*60;longnh=1000*60*60;longnm=1000*60;// long ns = 1000;// 获得两个时间的毫秒时间差异longdiff=endDate.getTime()-nowDate.getTime();// 计算差多少天longday=diff/nd;// 计算差多少小时longhour=diff%nd/nh;// 计...
Calendar类计算两个日期的差,需要转化成毫秒计算,然后再转化成天 例:import java.util.Calendar;public class Test{public static void main(String[] args){Calendar a = Calendar.getInstance(), b = Calendar.getInstance();a.set(2015, Calendar.MARCH, 31);b.set(2015, Calendar.APRIL, 1...