String oneHoursAgoTime="";
Date dt = new Date();
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd-HH");
Calendar rightNow = Calendar.getInstance();
rightNow.setTime(dt);
//rightNow.add(Calendar.DATE, -1);
rightNow.add(Calendar.HOUR, -1);
Date dt1=rightNow.getTime();
oneHoursAgoTime = sdf.format(dt1);
return oneHoursAgoTime;
时间: 2024-10-13 04:53:40