方法一 System.out.println(DateFormatUtils.format(System.currentTimeMillis() , "yyyy-MM-dd HH:mm:ss:SSS")); 方法二 System.out.println(DateUtil.date(System.currentTimeMillis()) .toString("yyyy-MM-dd HH:mm:ss:SSS")); 输出结果(String类型): 2023-09-14 21:12:45:823