java - 尝试理解 java SimpleTimeZone 规则

标签 java timezone

任何人都可以解释一下 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/

相关文章:

java - 在android中自定义图像的大小和尺寸

java - 我如何在 Spring 中使用角色?

java - log4j 可以配置为使用 Joda Time 的时区数据库吗?

java - Java 8 的 Oracle JVM 中物理存储的 'tz' 时区数据库在哪里?

java - 如何抑制标记为已弃用的 API 的警告。 @SuppressWarnings ("deprecation")似乎并没有抑制它

java - 仅在本地主机上的 Google App Engine 1.6.4 上使用 Jsoup 时出现 ClassFormatError

java - 我们可以通过改变Java中的返回类型(协变返回类型)来重写方法。为什么?

mysql - 允许用户从选择框中选择 SET time_zone

c - 在 C 中获取时区 GMT 偏移量

javascript - 与 UTC 和本地日期的全日历混淆