Aracılığıyla paylaş


SimpleTimeZone Class

Definition

SimpleTimeZone is a concrete subclass of TimeZone that represents a time zone for use with a Gregorian calendar.

[Android.Runtime.Register("java/util/SimpleTimeZone", DoNotGenerateAcw=true)]
public class SimpleTimeZone : Java.Util.TimeZone
[<Android.Runtime.Register("java/util/SimpleTimeZone", DoNotGenerateAcw=true)>]
type SimpleTimeZone = class
    inherit TimeZone
Inheritance
SimpleTimeZone
Attributes

Remarks

SimpleTimeZone is a concrete subclass of TimeZone that represents a time zone for use with a Gregorian calendar. The class holds an offset from GMT, called <em>raw offset</em>, and start and end rules for a daylight saving time schedule. Since it only holds single values for each, it cannot handle historical changes in the offset from GMT and the daylight saving schedule, except that the #setStartYear setStartYear method can specify the year when the daylight saving time schedule starts in effect.

To construct a SimpleTimeZone with a daylight saving time schedule, the schedule can be described with a set of rules, <em>start-rule</em> and <em>end-rule</em>. A day when daylight saving time starts or ends is specified by a combination of <em>month</em>, <em>day-of-month</em>, and <em>day-of-week</em> values. The <em>month</em> value is represented by a Calendar Calendar#MONTH MONTH field value, such as Calendar#MARCH. The <em>day-of-week</em> value is represented by a Calendar Calendar#DAY_OF_WEEK DAY_OF_WEEK value, such as Calendar#SUNDAY SUNDAY. The meanings of value combinations are as follows.

<ul> <li><b>Exact day of month</b><br> To specify an exact day of month, set the <em>month</em> and <em>day-of-month</em> to an exact value, and <em>day-of-week</em> to zero. For example, to specify March 1, set the <em>month</em> to Calendar#MARCH MARCH, <em>day-of-month</em> to 1, and <em>day-of-week</em> to 0.</li>

<li><b>Day of week on or after day of month</b><br> To specify a day of week on or after an exact day of month, set the <em>month</em> to an exact month value, <em>day-of-month</em> to the day on or after which the rule is applied, and <em>day-of-week</em> to a negative Calendar#DAY_OF_WEEK DAY_OF_WEEK field value. For example, to specify the second Sunday of April, set <em>month</em> to Calendar#APRIL APRIL, <em>day-of-month</em> to 8, and <em>day-of-week</em> to -Calendar#SUNDAY SUNDAY.</li>

<li><b>Day of week on or before day of month</b><br> To specify a day of the week on or before an exact day of the month, set <em>day-of-month</em> and <em>day-of-week</em> to a negative value. For example, to specify the last Wednesday on or before the 21st of March, set <em>month</em> to Calendar#MARCH MARCH, <em>day-of-month</em> is -21 and <em>day-of-week</em> is -Calendar#WEDNESDAY WEDNESDAY. </li>

<li><b>Last day-of-week of month</b><br> To specify, the last day-of-week of the month, set <em>day-of-week</em> to a Calendar#DAY_OF_WEEK DAY_OF_WEEK value and <em>day-of-month</em> to -1. For example, to specify the last Sunday of October, set <em>month</em> to Calendar#OCTOBER OCTOBER, <em>day-of-week</em> to Calendar#SUNDAY SUNDAY and <em>day-of-month</em> to -1. </li>

</ul> The time of the day at which daylight saving time starts or ends is specified by a millisecond value within the day. There are three kinds of <em>mode</em>s to specify the time: #WALL_TIME, #STANDARD_TIME and #UTC_TIME. For example, if daylight saving time ends at 2:00 am in the wall clock time, it can be specified by 7200000 milliseconds in the #WALL_TIME mode. In this case, the wall clock time for an <em>end-rule</em> means the same thing as the daylight time.

The following are examples of parameters for constructing time zone objects.

<code>
                 // Base GMT offset: -8:00
                 // DST starts:      at 2:00am in standard time
                 //                  on the first Sunday in April
                 // DST ends:        at 2:00am in daylight time
                 //                  on the last Sunday in October
                 // Save:            1 hour
                 SimpleTimeZone(-28800000,
                                "America/Los_Angeles",
                                Calendar.APRIL, 1, -Calendar.SUNDAY,
                                7200000,
                                Calendar.OCTOBER, -1, Calendar.SUNDAY,
                                7200000,
                                3600000)

                 // Base GMT offset: +1:00
                 // DST starts:      at 1:00am in UTC time
                 //                  on the last Sunday in March
                 // DST ends:        at 1:00am in UTC time
                 //                  on the last Sunday in October
                 // Save:            1 hour
                 SimpleTimeZone(3600000,
                                "Europe/Paris",
                                Calendar.MARCH, -1, Calendar.SUNDAY,
                                3600000, SimpleTimeZone.UTC_TIME,
                                Calendar.OCTOBER, -1, Calendar.SUNDAY,
                                3600000, SimpleTimeZone.UTC_TIME,
                                3600000)
</code>

These parameter rules are also applicable to the set rule methods, such as setStartRule.

Added in 1.1.

Java documentation for java.util.SimpleTimeZone.

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.

Constructors

SimpleTimeZone(Int32, String, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32)

Constructs a SimpleTimeZone with the given base time zone offset from GMT, time zone ID, and rules for starting and ending the daylight time.

SimpleTimeZone(Int32, String, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32)

Constructs a SimpleTimeZone with the given base time zone offset from GMT, time zone ID, and rules for starting and ending the daylight time.

SimpleTimeZone(Int32, String, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32)

Constructs a SimpleTimeZone with the given base time zone offset from GMT, time zone ID, and rules for starting and ending the daylight time.

SimpleTimeZone(Int32, String)

Constructs a SimpleTimeZone with the given base time zone offset from GMT and time zone ID with no daylight saving time schedule.

SimpleTimeZone(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

Fields

Long
Obsolete.

A style specifier for getDisplayName() indicating a long name, such as "Pacific Standard Time.

(Inherited from TimeZone)
Short
Obsolete.

A style specifier for getDisplayName() indicating a short name, such as "PST.

(Inherited from TimeZone)
StandardTime
Obsolete.

Constant for a mode of start or end time specified as standard time.

UtcTime
Obsolete.

Constant for a mode of start or end time specified as UTC.

WallTime
Obsolete.

Constant for a mode of start or end time specified as wall clock time.

Properties

Class

Returns the runtime class of this Object.

(Inherited from Object)
DisplayName

Returns a long standard time name of this TimeZone suitable for presentation to the user in the default locale.

(Inherited from TimeZone)
DSTSavings

Returns the amount of time to be added to local standard time to get local wall clock time.

(Inherited from TimeZone)
Handle

The handle to the underlying Android instance.

(Inherited from Object)
ID

Gets the ID of this time zone. -or- Sets the time zone ID.

(Inherited from TimeZone)
JniIdentityHashCode (Inherited from Object)
JniPeerMembers
PeerReference (Inherited from Object)
RawOffset

Gets the GMT offset for this time zone.

ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Methods

Clone()

Creates a copy of this TimeZone.

(Inherited from TimeZone)
Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
GetDisplayName(Boolean, TimeZoneStyle, Locale)

Returns the #SHORT short or #LONG long name of this time zone with either standard or daylight time, as written in locale.

(Inherited from TimeZone)
GetDisplayName(Boolean, TimeZoneStyle)

Returns a name in the specified style of this TimeZone suitable for presentation to the user in the default locale.

(Inherited from TimeZone)
GetDisplayName(Locale)

Returns a long standard time name of this TimeZone suitable for presentation to the user in the specified locale.

(Inherited from TimeZone)
GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
GetOffset(Int32, Int32, Int32, Int32, Int32, Int32)

Returns the difference in milliseconds between local time and UTC, taking into account both the raw offset and the effect of daylight saving, for the specified date and time.

GetOffset(Int64)

Returns the offset of this time zone from UTC at the specified date.

(Inherited from TimeZone)
HasSameRules(TimeZone)

Returns true if this zone has the same rule and offset as another zone.

(Inherited from TimeZone)
InDaylightTime(Date)

Queries if the given date is in daylight saving time.

JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
ObservesDaylightTime()

Returns true if this TimeZone is currently in Daylight Saving Time, or if a transition from Standard Time to Daylight Saving Time occurs at any future time.

(Inherited from TimeZone)
SetDSTSavings(Int32)

Sets the amount of time in milliseconds that the clock is advanced during daylight saving time.

SetEndRule(Int32, Int32, Int32, Int32, Boolean)

Sets the daylight saving time end rule to a weekday before or after the given date within a month, e.

SetEndRule(Int32, Int32, Int32, Int32)

Sets the daylight saving time end rule.

SetEndRule(Int32, Int32, Int32)

Sets the daylight saving time end rule to a fixed date within a month.

SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
SetStartRule(Int32, Int32, Int32, Int32, Boolean)

Sets the daylight saving time start rule to a weekday before or after the given date within a month, e.

SetStartRule(Int32, Int32, Int32, Int32)

Sets the daylight saving time start rule.

SetStartRule(Int32, Int32, Int32)

Sets the daylight saving time start rule to a fixed date within a month.

SetStartYear(Int32)

Sets the daylight saving time starting year.

ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
ToZoneId()

Converts this TimeZone object to a ZoneId.

(Inherited from TimeZone)
UnregisterFromRuntime() (Inherited from Object)
UseDaylightTime()

Queries if this time zone uses daylight saving time.

Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to