Java获取1小时前时间

SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Calendar cal = Calendar.getInstance();
String start_update = format.format(cal.getTime());
cal.set(Calendar.HOUR_OF_DAY, cal.get(Calendar.HOUR_OF_DAY)-1);
String end_update = format.format(cal.getTime());

猜你喜欢

转载自lizhou-900104.iteye.com/blog/2206922