TimeZone in java

The TimeZone class allows you to work with time zone offsets from Greenwich mean time (GMT), also referred to as Coordinated Universal Time (UTC). It also computes daylight saving time. TimeZone only supplies the default constructor

Some of the Methods Defined by TimeZone

 Method Description
 Object clone( )Returns a TimeZone-specific version of clone( ).
 static String[ ] getAvailableIDs( )Returns an array of String objects representing the
   names of all time zones.
   
 static String[ ]Returns an array of String objects representing the
 getAvailableIDs(int timeDelta)names of all time zones that are timeDelta offset from
   GMT.
   
 static TimeZone getDefault( )Returns a TimeZone object that represents the default
   time zone used on the host computer.
   
 String getID( )Returns the name of the invoking TimeZone object.
   
 abstract int getOffset(int era, int year,Returns the offset that should be added to GMT to
  int month,compute local time. This value is adjusted for daylight
  int dayOfMonth,saving time. The parameters to the method represent
  int dayOfWeek,date and time components.
  int millisec) 
   
 abstract int getRawOffset( )Returns the raw offset that should be added to GMT
   to compute local time. This value is not adjusted for
   daylight saving time.
   
 static TimeZoneReturns the TimeZone object for the time zone named
 getTimeZone(String tzName)tzName.
   
 abstract boolean inDaylightTime(Date d)Returns true if the date represented by d is in daylight
   saving time in the invoking object. Otherwise, it
   returns false.
   
 static void setDefault(TimeZone tz)Sets the default time zone to be used on this host. tz
   is a reference to the TimeZone object to be used.
 void setID(String tzName)Sets the name of the time zone (that is, its ID) to that
   specified by tzName.
 abstract void setRawOffset(int millis)Sets the offset in milliseconds from GMT.
   
 abstract boolean useDaylightTime( )Returns true if the invoking object uses daylight saving
   time. Otherwise, it returns false.

Leave a Comment