//@2016-12-13 获取当前时间,指定前面多少小时的时间
//返回格式YYYYMMDDHHMMSS
public static String getBeforeHourTime(int ihour){ Calendar calendar = Calendar.getInstance();
//Calendar.HOUR_OF_DAY 改一下就是分钟 、天 、月
calendar.set(Calendar.HOUR_OF_DAY, calendar.get(Calendar.HOUR_OF_DAY) - ihour);
SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");
String str = "";
//calendar.getTime()为date型
str = df.format(calendar.getTime());
return str;
}