public static void main(String args []) throws Exception {
changeTime("20220910155900",1);//当前时间+1小时
}
public static void changeTime(String time,int addNum) throws Exception {
SimpleDateFormat sd = new SimpleDateFormat("yyyyMMddkkmmss");
Date date = sd.parse(time);
System.out.println("front:" + sd.format(date)); //显示输入的日期
long times = date.getTime()+(1000*60*60*addNum);//时间戳加减
System.out.println("after:" + sd.format(times)); //显示更新后的日
}