标签:输出,格式化,java,param,SimpleDateFormat,sdf,new,TimeZone From: https://www.cnblogs.com/niuniu0108/p/17358389.html
/**
* 打印当前时间
*
* @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);
}