Java – SimpleTimeZone Class

Java SimpleTimeZone Class methods, constructors, variables available in Java 8 release are listed below. We will publish example program on each methods ASAP.

Variables in Java SimpleTimeZone Class

S.No Variable & Description
1 static int STANDARD_TIME

Constant for a mode of start or end time specified as standard time.
2 static int UTC_TIME

Constant for a mode of start or end time specified as UTC.
3 static int WALL_TIME

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

Constructors in Java SimpleTimeZone Class

S.No Constructor & Description
1 SimpleTimeZone(int rawOffset, String ID)

Constructs a SimpleTimeZone with the given base time zone offset from GMT and time zone ID with no daylight saving time schedule.
2 SimpleTimeZone(int rawOffset, String ID, int startMonth, int startDay, int startDayOfWeek, int startTime, int endMonth, int endDay, int endDayOfWeek, int endTime)

Constructs a SimpleTimeZone with the given base time zone offset from GMT, time zone ID, and rules for starting and ending the daylight time.
3 SimpleTimeZone(int rawOffset, String ID, int startMonth, int startDay, int startDayOfWeek, int startTime, int endMonth, int endDay, int endDayOfWeek, int endTime, int dstSavings)

Constructs a SimpleTimeZone with the given base time zone offset from GMT, time zone ID, and rules for starting and ending the daylight time.
4 SimpleTimeZone(int rawOffset, String ID, int startMonth, int startDay, int startDayOfWeek, int startTime, int startTimeMode, int endMonth, int endDay, int endDayOfWeek, int endTime, int endTimeMode, int dstSavings)

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

Methods in Java SimpleTimeZone Class

S.No Method & Description
1 Object clone()

Returns a clone of this SimpleTimeZone instance.
2 boolean equals(Object obj)

Compares the equality of two SimpleTimeZone objects.
3 int getDSTSavings()

Returns the amount of time in milliseconds that the clock is advanced during daylight saving time.
4 int getOffset(int era, int year, int month, int day, int dayOfWeek, int millis)

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.
5 int getOffset(long date)

Returns the offset of this time zone from UTC at the given time.
6 int getRawOffset()

Gets the GMT offset for this time zone.
7 int hashCode()

Generates the hash code for the SimpleDateFormat object.
8 boolean hasSameRules(TimeZone other)

Returns true if this zone has the same rules and offset as another zone.
9 boolean inDaylightTime(Date date)

Queries if the given date is in daylight saving time.
10 boolean observesDaylightTime()

Returns true if this SimpleTimeZone observes Daylight Saving Time.
11 void setDSTSavings(int millisSavedDuringDST)

Sets the amount of time in milliseconds that the clock is advanced during daylight saving time.
12 void setEndRule(int endMonth, int endDay, int endTime)

Sets the daylight saving time end rule to a fixed date within a month.
13 void setEndRule(int endMonth, int endDay, int endDayOfWeek, int endTime)

Sets the daylight saving time end rule.
14 void setEndRule(int endMonth, int endDay, int endDayOfWeek, int endTime, boolean after)

Sets the daylight saving time end rule to a weekday before or after the given date within a month, e.g., the first Monday on or after the 8th.
15 void setRawOffset(int offsetMillis)

Sets the base time zone offset to GMT.
16 void setStartRule(int startMonth, int startDay, int startTime)

Sets the daylight saving time start rule to a fixed date within a month.
17 void setStartRule(int startMonth, int startDay, int startDayOfWeek, int startTime)

Sets the daylight saving time start rule.
18 void setStartRule(int startMonth, int startDay, int startDayOfWeek, int startTime, boolean after)

Sets the daylight saving time start rule to a weekday before or after the given date within a month, e.g., the first Monday on or after the 8th.
19 void setStartYear(int year)

Sets the daylight saving time starting year.
20 String toString()

Returns a string representation of this time zone.
21 boolean useDaylightTime()

Queries if this time zone uses daylight saving time.

Ask your questions in eHowToNow Forum

Post your technical, non-technical doubts, questions in our site. Get answer as soon as possible, meanwhile you can help others by answering, unanswered questions.
To Ask new Question : Ask Question
Check our existing discussions : Questions & Answers

  1. Java – RandomAccess Interface
  2. Java – AbstractQueuedLongSynchronizer Class
  3. Java ArrayList retainAll() method with example
  4. Java – Consumer Interface
  5. Java – LongToIntFunction Interface
  6. Java – ToIntFunction Interface
  7. Java – ForkJoinPool.ForkJoinWorkerThreadFactory Interface
  8. Java – WeakHashMap Class
  9. Java – Objects Class in Util Package
  10. Java – TimerTask Class
  11. How to validate Email Address using Java Regular Expression
  12. Java – Collection Interface
  13. Java – Formattable Interface
  14. Java – Date Class
  15. Java – EnumSet Class

Be the first to comment

Leave a Reply