SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 格式化日期
Date d = new Date(sdf.parse(map.get("buyDatetime")+"").getTime()+24*3600*1000); 增加一天
Date d1 = new Date(sdf.parse(map.get("buyDatetime")+"").getTime()+24*3600*1000*2); 增加二天
yyyy-MM-dd E ****年**月**日 星期*
计算梁时间之间的差
SimpleDateFormat dfs = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); java.util.Date begin=dfs.parse("2004-01-02 11:30:24"); java.util.Date end = dfs.parse("2004-03-26 13:31:40"); long between=(end.getTime()-begin.getTime())/1000;//除以1000是为了转换成秒 long day1=between/(24*3600); long hour1=between%(24*3600)/3600; long minute1=between%3600/60; long second1=between%60/60; System.out.println(""+day1+"天"+hour1+"小时"+minute1+"分"+second1+"秒");