/**获取上n个小时整点小时时间
* @param date
* @return
*/
public static String getLastHourTime(Date date,int n){
Calendar ca = Calendar.getInstance();
ca.set(Calendar.MINUTE, 0);
ca.set(Calendar.SECOND, 0);
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
ca.set(Calendar.HOUR_OF_DAY, ca.get(Calendar.HOUR_OF_DAY)-n);
date = ca.getTime();
return sdf.format(date);
}
/**获取当前时间的整点小时时间
* @param date
* @return
*/
public static String getCurrHourTime(Date date){
Calendar ca = Calendar.getInstance();
ca.set(Calendar.MINUTE, 0);
ca.set(Calendar.SECOND, 0);
date = ca.getTime();
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
return sdf.format(date);
}