张世豪
21 小时以前 ed6936545d20cc490145d2936cee4387be2afd53
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);
    }
 
}