产值
This commit is contained in:
@ -159,6 +159,11 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
||||
public static LocalDate parseLocalDateTime(final FormatsType format, final String ts) {
|
||||
try {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(format.getTimeFormat());
|
||||
// 如果是年月格式,则默认设置为该月第一天
|
||||
if (format.getTimeFormat().equals("yyyy-MM") || format.getTimeFormat().equals("yyyy/MM") || format.getTimeFormat().equals("yyyy.MM")) {
|
||||
YearMonth yearMonth = YearMonth.parse(ts, formatter);
|
||||
return yearMonth.atDay(1);
|
||||
}
|
||||
return LocalDate.parse(ts, formatter);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
|
||||
Reference in New Issue
Block a user