官方给出的案例以及网上查询时区都是这样的
tz('Asia/Shanghai')
那我们想要按照GMT+12时区或者是其他时区怎么办呢怎么办呢,
其实官网文档有给出我们所有的时区转换,不过好像得fan qiang
我给出自己整理的所有的转换,需要的时候直接通过map来获取就好啦
private static final Map<String,String> TIME_ZONE = new HashMap<String,String>();
static {
TIME_ZONE.put("GMT+12", "Etc/GMT-12");
TIME_ZONE.put("GMT+11", "Etc/GMT-11");
TIME_ZONE.put("GMT+10", "Etc/GMT-10");
TIME_ZONE.put("GMT+9", "Etc/GMT-9");
TIME_ZONE.put("GMT+8", "Etc/GMT-8");
TIME_ZONE.put("GMT+7", "Etc/GMT-7");
TIME_ZONE.put("GMT+6", "Etc/GMT-6");
TIME_ZONE.put("GMT+5", "Etc/GMT-5");
TIME_ZONE.put("GMT+4", "Etc/GMT-4");
TIME_ZONE.put("GMT+3", "Etc/GMT-3");
TIME_ZONE.put("GMT+2", "Etc/GMT-2");
TIME_ZONE.put("GMT+1", "Etc/GMT-1");
TIME_ZONE.put("GMT+0", "Etc/GMT");
TIME_ZONE.put("GMT-1", "Etc/GMT+1");
TIME_ZONE.put("GMT-2", "Etc/GMT+2");
TIME_ZONE.put("GMT-3", "Etc/GMT+3");
TIME_ZONE.put("GMT-4", "Etc/GMT+4");
TIME_ZONE.put("GMT-5", "Etc/GMT+5");
TIME_ZONE.put("GMT-6", "Etc/GMT+6");
TIME_ZONE.put("GMT-7", "Etc/GMT+7");
TIME_ZONE.put("GMT-8", "Etc/GMT+8");
TIME_ZONE.put("GMT-9", "Etc/GMT+9");
TIME_ZONE.put("GMT-10", "Etc/GMT+10");
TIME_ZONE.put("GMT-11", "Etc/GMT+11");
TIME_ZONE.put("GMT-12", "Etc/GMT+12");
}