Java SimpleTimeZone Class



Introduction

The Java SimpleTimeZone class is a concrete subclass of TimeZone that represents a time zone for use with a Gregorian calendar. Following are the important points about SimpleTimeZone −

  • The class holds an offset from GMT, called raw offset.

  • This class also holds start and end rules for a daylight saving time schedule.

Class declaration

Following is the declaration for java.util.SimpleTimeZone class −

public class SimpleTimeZone
   extends TimeZone

Field

Following are the fields for java.util.SimpleTimeZone class −

  • static int STANDARD_TIME − This is the constant for a mode of start or end time specified as standard time.

  • static int UTC_TIME − This is the constant for a mode of start or end time specified as UTC.

  • static int WALL_TIME − This is the constant for a mode of start or end time specified as wall clock time.

It also consists of fields inherited from class TimeZone.

Class constructors

Sr.No. Constructor & Description
1

SimpleTimeZone(int rawOffset, String ID)

This 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)

This 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)

This 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)

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

Class methods

Sr.No. Method & Description
1 Object clone()

This method returns a clone of this SimpleTimeZone instance.

2