java 获取任一个时区时间

TimeZone timeZone = TimeZone.getTimeZone("Etc/GMT-8"); 

 SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH:mm:ss");
 simpleDateFormat.setTimeZone(timeZone);

System.out.println(simpleDateFormat.format(new Date()));

猜你喜欢

转载自blog.csdn.net/qq_38598257/article/details/82632061