TimeZone.ObservesDaylightTime Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Queries if this time zone is in daylight saving time or will observe daylight saving time at any future time.
[Android.Runtime.Register("observesDaylightTime", "()Z", "GetObservesDaylightTimeHandler", ApiSince=24)]
public virtual bool ObservesDaylightTime ();
[<Android.Runtime.Register("observesDaylightTime", "()Z", "GetObservesDaylightTimeHandler", ApiSince=24)>]
abstract member ObservesDaylightTime : unit -> bool
override this.ObservesDaylightTime : unit -> bool
Returns
true
if this time zone is in daylight saving time or will observe
daylight saving time at any future time.
- Attributes
Remarks
Queries if this time zone is in daylight saving time or will observe daylight saving time at any future time.
The default implementation in this class returns true
if #useDaylightTime()
or #inDaylightTime(Date) inDaylightTime(new Date())
returns true
.
<strong>Note:</strong> This method was added for java.util.TimeZone
compatibility support. The java.util.TimeZone#useDaylightTime()
method only checks the last known rule(s), therefore it may return false even the zone observes daylight saving time currently. java.util.TimeZone
added observesDaylightTime()
to resolve the issue. In ICU, #useDaylightTime()
works differently. The ICU implementation checks if the zone uses daylight saving time in the current calendar year. Therefore, it will never return false
if daylight saving time is currently used.
ICU's TimeZone subclass implementations override this method to support the same behavior with java.util.TimeZone#observesDaylightTime()
. Unlike #useDaylightTime()
, the implementation does not take past daylight saving time into account, so that this method may return false
even when #useDaylightTime()
returns true
.
Java documentation for android.icu.util.TimeZone.observesDaylightTime()
.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.