作者 shenhailong

添加 列表查询 主单号—— 工具类 +不+ - 问题

... ... @@ -31,6 +31,12 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>RELEASE</version>
</dependency>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>RELEASE</version>
... ...
... ... @@ -49,6 +49,17 @@ public final class DateUtil {
return sdf_yyyyMMdd.format(new Date());
}
public static String get_yyyyMMdd(String date) throws ParseException {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
Date parse = simpleDateFormat.parse(date);
return sdf_yyyyMMdd.format(parse);
}
public static Date formatByyyyyMMdd(String dateStr){
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
LocalDate beginDateTime = LocalDate.parse(dateStr, formatter);
... ... @@ -81,7 +92,7 @@ public final class DateUtil {
* @return 20190916071330431
*/
public static String getCurrentTime17(){
return timesdfsss.format(currentDate);
return timesdfsss.format(new Date());
}
/**
... ... @@ -484,4 +495,32 @@ public final class DateUtil {
}
return age;
}
/**
* 给时间加上几个小时
* @param day 当前时间 格式:yyyy-MM-dd HH:mm:ss
* @param hour 需要加的时间
* @return
*/
public static String addDateMinut(Date day, int hour){
SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss");
Date date = null;
try {
date = day;
} catch (Exception ex) {
ex.printStackTrace();
}
if (date == null)
return "";
// System.out.println("front:" + format.format(date)); //显示输入的日期
Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.add(Calendar.HOUR, hour);// 24小时制
date = cal.getTime();
// System.out.println("after:" + format.format(date)); //显示更新后的日期
cal = null;
return format.format(date);
}
}
... ...
package com.tianbo.util.nmms;
public class AwbaUtils {
public static String awba(String awba){
if (awba.contains("-")){
return awba;
}else {
StringBuffer stringBuffer = new StringBuffer(awba);
String s = stringBuffer.insert(3, "-").toString();
return s;
}
}
}
... ...