/** |
* 获取距现在某一小时的时刻 |
* @param format 格式化时间的格式 |
* @param h 距现在的小时 例如:h=-1为上一个小时,h=1为下一个小时 |
* @return |
*/ |
public static String getpreHour(String format, int h){ |
SimpleDateFormat sdf = new SimpleDateFormat(format); |
Date date = new Date(); |
date.setTime(date.getTime()+h* 60 * 60 * 1000 ); |
return sdf.format(date); |
} |