标签:系统时间 size time span pac local color new util
TimeUtils:
package com.duocy.util;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
public class TimeUtils {
/* public static String getTime() {
Date date = new Date();
SimpleDateFormat dateFormat= new SimpleDateFormat("yyyy/MM/dd hh:mm:ss");
String dt=dateFormat.format(date);
System.out.println("当前系统时间:"+dt);
return dt;
}*/
public static String getTime() {
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
LocalDateTime time = LocalDateTime.now();
String localTime = df.format(time);
System.out.println(localTime);
return localTime;
}
}
个人记录之用!
标签:系统时间 size time span pac local color new util
原文地址:https://www.cnblogs.com/juzijiang/p/9707636.html