/**
* 打印当前时间
*
* @return
*/
public static void printCurrentTime(String param) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// 关键所在
TimeZone gmt = TimeZone.getTimeZone("GMT+8");
sdf.setTimeZone(gmt);
sdf.setLenient(true);
System.out.println(sdf.format(new Date()) + ":" + param);
}
java 格式化输出当前时间
发布时间 2023-04-27 11:07:12作者: 田坤坤