mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 11:05:18 +08:00
update 江苏省平台接口
This commit is contained in:
@@ -1033,4 +1033,23 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
||||
long timestamp = localDateTime.toInstant(ZoneOffset.of("+8")).toEpochMilli();
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将 YYYY-MM-DD HH:mm:ss 转换为 YYYY-MM-DD
|
||||
* @param dateTimeString
|
||||
* @return
|
||||
*/
|
||||
public static String convertDateTimeToDate(String dateTimeString) {
|
||||
SimpleDateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
SimpleDateFormat outputFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
|
||||
try {
|
||||
Date date = inputFormat.parse(dateTimeString);
|
||||
return outputFormat.format(date);
|
||||
} catch (ParseException e) {
|
||||
// 处理解析异常
|
||||
e.printStackTrace();
|
||||
return null; // 或者返回一个默认值
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user