Does Java 8’s ZoneOffset Account For DST?
As I mentioned in title, does Java 8's ZoneOffset account for DST? Can I have different zone offsets in different summer/winter time?
Answer
No, a ZoneOffset
is constant. To account for summer time (daylight saving time), you need a ZoneId
, it accounts for DST and other changes in UTC offset. And will thus correspond to different ZoneOffset
s in summer and winter if your time zone uses DST (far from all time zones do).
EDIT: ZoneOffset
is a subclass of ZoneId
, so you may say that a ZoneOffset
is also a kind of ZoneId
. But a special kind of ZoneId
where the offset never changes. This inheritance relationship does not reflect the relationship between offsets and zones in real life, but has been made so because it is very often practical in programming.
Related Questions
- → How to update data attribute on Ajax complete
- → October CMS - Radio Button Ajax Click Twice in a Row Causes Content to disappear
- → Octobercms Component Unique id (Twig & Javascript)
- → Passing a JS var from AJAX response to Twig
- → Laravel {!! Form::open() !!} doesn't work within AngularJS
- → DropzoneJS & Laravel - Output form validation errors
- → Import statement and Babel
- → Uncaught TypeError: Cannot read property '__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED' of undefined
- → React-router: Passing props to children
- → ListView.DataSource looping data for React Native
- → Can't test submit handler in React component
- → React + Flux - How to avoid global variable
- → Webpack, React & Babel, not rendering DOM