对于下面的代码,我得到不同的输出
TimeZone t = TimeZone.getTimeZone("GMT-8"); // Also tried UTC-8 and GMT-8:00
//TimeZone t = TimeZone.getTimeZone("America/Los_Angeles");
SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");
Date d = null;
Calendar c = Calendar.getInstance(t);
c.set(Calendar.MONTH, Calendar.AUGUST);
c.set(Calendar.DAY_OF_MONTH, 22);
c.set(Calendar.YEAR, 2013);
d = c.getTime();
String s = sdf.format(d);
System.out.println(s + " " + t.inDaylightTime(d));
输出是:
08/22/2013 false
现在America/Los_Angeles是 GMT-8 / UTC-8 或 PST。但是当我将参数从 GMT-8 更改为America/Los_Angeles时,
输出是:
08/22/2013 true
自弃用以来,不能使用类似 PST 的缩写。CST 也可以表示Central Standard time和China Standard Time。
我的输入类似于 -8、-9 -14 等,我希望在其前面加上 GMT/UTC 以了解我是否可以在给定日期获得 DST 激活。
请在这方面指导我。