C#返回多少分钟之前或者之后的时间
/** * 获取给定时间的之前某分钟的时间 * 比如现在是:2012-10-10 10:10:10 * 给定的分钟数:50 * 得到的时间为:2012-10-10 9:20:10 * * @return strLateMinutesTime 时间字符 */ public static String getLateMinutesTime(Date objDate, String strMinutes) { String strLateMinutesTime = ""; int intMinutes = 1; intMinutes = Integer.parseInt(strMinutes); try { SimpleDateFormat objFormat = new SimpleDateFormat( "yyyy-MM-dd hh:mm:ss"); SimpleDateFormat objFormatter = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss"); strLateMinutesTime = objFormat.format(objDate); Date objDate2 = objFormat.parse(strLateMinutesTime); long objTime = (objDate2.getTime() / 1000) - 60 * intMinutes; objDate2.setTime(objTime * 1000); strLateMinutesTime = objFormatter.format(objDate2); } catch (ParseException ex) { ex.printStackTrace(); } return strLateMinutesTime; }