/** * 时间戳 * @return */ public static String CreateDate(){ String dataStr=null; SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddhhmmss"); dataStr = sdf.format(new Date()); return dataStr; } /** * 失效时间 当前时间+10min * @param num * @return */ public static String expriredDate(String dataStr){ String aDataStr=null; try { SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddhhmmss"); Date date = sdf.parse(dataStr); date.setTime(date.getTime()+10*60*1000); aDataStr=sdf.format(date); } catch (ParseException e) { e.printStackTrace(); } return aDataStr; }