//在某一个时间点上加两小时的写法
Calendar calendar = Calendar.getInstance();
//此处setTime为Date类型
calendar.setTime(goods.getAddTime());
//加上两小时
calendar.add(Calendar.HOUR, 2);//时
//进行时间格式化
SimpleDateFormat s = new SimpleDateFormat("yyyy-MM-dd HH:mm");
onlineGoods.put("InvalidTime",s.format(calendar.getTime()));
在某一个时间点上添加两小时的写法
最新推荐文章于 2022-11-18 09:13:46 发布