| | |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static Date parseString(String str) throws Exception { |
| | | return Format_2.parse(str); |
| | | public static Date parseString(String str) { |
| | | try { |
| | | return Format_2.parse(str); |
| | | }catch (Exception e) |
| | | { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static Date parseString(String str, String format) throws Exception { |
| | | public static Date parseString(String str, String format) { |
| | | SimpleDateFormat sdf = new SimpleDateFormat(format); |
| | | return sdf.parse(str); |
| | | try{ |
| | | return sdf.parse(str); |
| | | }catch (Exception e) |
| | | { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /**字符串转成时间yyyy-MM-dd HH:mm:ss*/ |
| | |
| | | return c.getTime(); |
| | | } |
| | | |
| | | /**时间上月数叠加 |
| | | * @Author: ChenJiaHe |
| | | * @param dateTime 时间 |
| | | * @param dayNum 天数 |
| | | * @return |
| | | */ |
| | | public static Date addMonth(Date dateTime,int dayNum){ |
| | | Calendar c = Calendar.getInstance(); |
| | | c.setTime(dateTime); |
| | | c.add(Calendar.MONTH, dayNum); |
| | | return c.getTime(); |
| | | } |
| | | |
| | | /**时间上年数叠加 |
| | | * @Author: ChenJiaHe |
| | | * @param dateTime 时间 |