| | |
| | | return sdf.parse(str); |
| | | } |
| | | |
| | | /**字符串转成时间yyyy-MM-dd HH:mm:ss*/ |
| | | public static Date parseString_1(String str) |
| | | { |
| | | try{ |
| | | return Format_3.parse(str); |
| | | }catch (Exception e) |
| | | { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /**字符串转成时间yyyy-MM-dd*/ |
| | | public static Date parseString_2(String str) |
| | | { |
| | | try{ |
| | | return Format_4.parse(str); |
| | | }catch (Exception e) |
| | | { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | |
| | | /**时间上分钟叠加 |
| | | * @Author: ChenJiaHe |
| | | * @param dateTime 时间 |
| | |
| | | return status; |
| | | } |
| | | |
| | | /**把秒转换成X天X时X分X秒*/ |
| | | public static String getChineseStr(Integer second) |
| | | { |
| | | int day = 24 * 60 * 60; |
| | | int hour = 60 * 60; |
| | | int min = 60; |
| | | |
| | | int dayNum = second / day; |
| | | int hourNum = second % day / hour; |
| | | int minNum = second % day % hour / min; |
| | | second = second % day % hour % min; |
| | | |
| | | String str = dayNum > 0 ? dayNum + "天" : ""; |
| | | str += hourNum > 0 ? hourNum + "时" : ""; |
| | | str += minNum > 0 ? minNum + "分" : ""; |
| | | str += second + "秒"; |
| | | |
| | | return str; |
| | | } |
| | | |
| | | } |