【新增】封装时间工具
This commit is contained in:
14
src/main/java/com/corewing/app/util/DateUtils.java
Normal file
14
src/main/java/com/corewing/app/util/DateUtils.java
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
package com.corewing.app.util;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
|
||||||
|
public class DateUtils {
|
||||||
|
|
||||||
|
// 格式化LocalDateTime为字符串
|
||||||
|
public static String format(LocalDateTime time, String pattern) {
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern);
|
||||||
|
return time.format(formatter);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user