feat:时间工具类
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.xiang.xservice.basic.utils;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
@@ -20,4 +21,9 @@ public class DateUtils {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
return LocalDateTime.parse(dateTimeStr, formatter);
|
||||
}
|
||||
|
||||
public static LocalDate getDateFromStr(String date) {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy/MM/dd");
|
||||
return LocalDate.parse(date, formatter);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user