1.获取Timestamp格式的时间
Date date = new Date(); Timestamp ts = new Timestamp(date.getTime());
2.遍历一个Map集合
Map<String,Object> map = new HashMap<String,Object>; Set<String> set = map.keySet(); for(String key:set){ map.get(key); }
3.判断一个字符串中是否包含指定字符
String reg = ("['\<>$!%#*&]"); Pattern p = Pattern.compile(reg); Matcher m = p.matcher(value); boolean flag = m.find(); //包含返回true 不包含返回false
4.把String转换成Date
DateFormat df = new SimpleDateFormat("yy-MM-dd HH:mm:ss"); String date = df.format(new Date()); Date currentDate = df.parse(date);