任何人都可以解释一下 Java SimpleTimeZone 规则是如何解释的吗?例如,欧洲/伦敦的规则如下:
var rule = {
"dstSavings": 3600000,
"startYear": 0,
"startMonth": 2,
"startDay": -1,
"startDayOfWeek": 1,
"endMonth": 9,
"endDay": -1,
"endDayOfWeek": 1,
"endTime": 3600000,
"rawOffset": 0,
"startTime": 3600000,
"startTimeMode": "UTC",
"endTimeMode": "UTC",
"useDaylight": true
};
阅读STZ documentation有帮助,但不适用于此特定规则。
endDay = 0 表示什么?如果startDay = 0怎么办?
谢谢
最佳答案
在 the API (您在问题中提供的相同链接),构造函数文档说:
"startDay - The day of the month on which the daylight saving time starts. See the class description for the special cases of this parameter."
"endDay - The day of the month on which the daylight saving time ends. See the class description for the special cases of this parameter."
您能更具体地说明一下令人困惑的地方吗?
编辑:
好的,我现在更好地理解你的问题了。正如您自己所了解的那样,正数意味着“向前计数”,负数意味着“向后计数”。 零似乎表示该位置没有启用夏令时。
编辑2:
每the source ,“0 值是非法的。”请参阅第 984 行和第 1045 行。如果 useDaylight
为 false,则这似乎没问题,但示例 JSON 中并非如此。
关于java - 尝试理解 java SimpleTimeZone 规则,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2412384/