java 字符串yyyyMMdd格式化为yyyy-MM-dd日期格式

2018-06-12 15:21:37
/**    *将字符串格式yyyyMMdd的字符串转为日期,格式"yyyy-MM-dd"    *    * @param date 日期字符串    * @return 返回格式化的日期    * @throws ParseException 分析时意外地出现了错误异常    */   public static String strToDateFormat(String date) throws ParseException {
       SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd");
       formatter.setLenient(false);
       Date newDate= formatter.parse(date);
       formatter = new SimpleDateFormat("yyyy-MM-dd");       return formatter.format(newDate);
   }
  • 2018-02-23 17:20:44

    Mysql数据库If语句的使用

    MySQL的if既可以作为表达式用,也可在存储过程中作为流程控制语句使用,如下是做为表达式使用:

  • 2018-02-24 10:16:36

    Java工具类之Apache的Commons Lang和BeanUtils

    Apache Commons包估计是Java中使用最广发的工具包了,很多框架都依赖于这组工具包中的一部分,它提供了我们常用的一些编程需要,但是JDK没能提供的机能,最大化的减少重复代码的编写。