mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 19:15:35 +08:00
update DateUtils 工具类
This commit is contained in:
@@ -153,6 +153,9 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
||||
public static void main(String[] args) throws ParseException {
|
||||
String startDate = "2023-07-01";
|
||||
String endDate = "2023-07-20";
|
||||
LocalDate of = LocalDate.of(2023, 07, 20);
|
||||
System.out.println(of);
|
||||
|
||||
List<String> list = getAllDatesInTheDateRange(startDate, endDate);
|
||||
System.out.println(list);
|
||||
|
||||
@@ -309,14 +312,14 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* localDate转dateStr
|
||||
* localDate转dateStr 直接 .toString()
|
||||
* @param localDate
|
||||
* @return 格式"yyyy-MM-dd"
|
||||
*/
|
||||
public static String localDate2DateStr(LocalDate localDate) {
|
||||
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
return localDate.format(df);
|
||||
}
|
||||
// public static String localDate2DateStr(LocalDate localDate) {
|
||||
// DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
// return localDate.format(df);
|
||||
// }
|
||||
|
||||
/**
|
||||
* Date转LocalDateTime
|
||||
@@ -909,7 +912,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
||||
}
|
||||
List<String> resultList = new ArrayList<>();
|
||||
localDateList.forEach(localDate -> {
|
||||
String dateStr = localDate2DateStr(localDate);
|
||||
String dateStr = localDate.toString();
|
||||
resultList.add(dateStr);
|
||||
});
|
||||
return resultList;
|
||||
|
||||
Reference in New Issue
Block a user