开发者

trying to understand java SimpleTimeZone rules

Can any one explain how Java SimpleTimeZone rules are interpreted. For example a rule for Europe/London is as follows:

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
  };

Reading the STZ documentation is helpful but not for this particular rule.

What does endDay = 0 signify? What if startDay = 0?

thanks,


In the API (same link you provided in the question), the constructor documentation says:

"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."

Could you be more specific about what's confusing?

EDIT:

Okay, I better understand your question now. As you have figured out for yourself, a positive number means "count forwards" and a negative number means "count backwards." Zero appears to indicate that there is no daylight savings active in that location.

EDIT 2:

Per the source, "a value of 0 is illegal." See lines 984 and 1045. This appears to be okay, if useDaylight is false, though that is not the case in your sample JSON.


endDay and startDay indicate the end and start of Daylight Saving Time. As this is always in the night from saturday till sunday. When describing DST this indicated the 'startDay'th Sunday of the month. In this case I'm not entirely sure what -1 means. In linux timezones a 5 indicates the last day of the month, so maybe here that is -1.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜