|
@ -6,8 +6,6 @@ import org.springframework.util.StringUtils;
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
import java.sql.Time;
|
|
import java.sql.Time;
|
|
import java.sql.Timestamp;
|
|
import java.sql.Timestamp;
|
|
import java.text.ParseException;
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
import java.time.*;
|
|
import java.time.*;
|
|
import java.time.format.DateTimeFormatter;
|
|
import java.time.format.DateTimeFormatter;
|
|
import java.time.temporal.ChronoUnit;
|
|
import java.time.temporal.ChronoUnit;
|
|
@ -129,25 +127,8 @@ public class DateUtil {
|
|
return ymd != null && ymd.length() == "yyyy-MM-dd".length() ? ymd.substring(0, 4) : null;
|
|
return ymd != null && ymd.length() == "yyyy-MM-dd".length() ? ymd.substring(0, 4) : null;
|
|
}
|
|
}
|
|
|
|
|
|
public static String utcToDate(String utcTime, String format) {
|
|
|
|
SimpleDateFormat utcSdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
|
|
|
|
SimpleDateFormat newSdf = new SimpleDateFormat(format);
|
|
|
|
String date = null;
|
|
|
|
|
|
|
|
try {
|
|
|
|
if (!org.apache.commons.lang3.StringUtils.isEmpty(utcTime)) {
|
|
|
|
date = newSdf.format(utcSdf.parse(utcTime));
|
|
|
|
}
|
|
|
|
} catch (ParseException var6) {
|
|
|
|
var6.printStackTrace();
|
|
|
|
}
|
|
|
|
|
|
|
|
return date;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static String getCurrentString(String pattern) {
|
|
public static String getCurrentString(String pattern) {
|
|
SimpleDateFormat f = new SimpleDateFormat(pattern);
|
|
|
|
return f.format(Calendar.getInstance(TimeZone.getDefault()).getTime());
|
|
|
|
|
|
return DateTimeFormatter.ofPattern(pattern).format(dateToLocalDateTime(new Date()));
|
|
}
|
|
}
|
|
|
|
|
|
public static String utcToDate(Date date) {
|
|
public static String utcToDate(Date date) {
|