张世豪
4 天以前 df006129448b6f0653b67caed7c061b84af8e1df
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
package chuankou;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
 
public class TimestampUtil {
    /**
     * 获取年月日时分秒毫秒的时间戳
     * @return 时间戳字符串
     */
    public static String getTimestamp() {
        LocalDateTime now = LocalDateTime.now();
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS");
        return now.format(formatter);
    }
 
}