记录下获取GMT时间的方法:
 //格式可根据需要自定义,如yyyy-MM-dd HH:mm:ss 等等
 SimpleDateFormat sdf = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss 'GMT'", Locale.US);
 Calendar calendar = Calendar.getInstance();
 sdf.setTimeZone(TimeZone.getTimeZone("GMT")); // 设置时区为GMT
 String dateStr = sdf.format(calendar.getTime());
 System.out.println("格林威治时间为:" + dateStr);
 输出结果为:格林威治时间为:Wed, 3 Jun 2020 07:03:57 GMT
运行j截图
