TimeZone class methods in Java

java.util.TimeZone

TimeZone represents a time zone offset, and also figures out daylight savings.

Some methods of TimeZone class.


clone()This method creates a copy of this TimeZone.


Constants: Some constants TimeZone.LONG, TimeZone.SHORT


getAvailableIDs()This method gets all the available IDs supported.


TimeZone.getAvailableIDs(int)This method gets the available IDs according to the given time zone offset in milliseconds.


TimeZone.getDefault()This method gets the default TimeZone of the Java virtual machine.


getDisplayName()This method returns a long standard time name of this TimeZone suitable for presentation to the user in the default locale.


getDisplayName(Locale)his method returns a long standard time name of this TimeZone suitable for presentation to the user in the specified locale.


getDisplayName(boolean, int)This method returns a name in the specified style of this TimeZone suitable for presentation to the user in the default locale.


getDisplayName(boolean, int, Locale)This method returns a name in the specified style of this TimeZone suitable for presentation to the user in the specified locale.


getDSTSavings()This method returns the amount of time to be added to local standard time to get local wall clock time.


getID()This method gets the ID of this time zone.


getOffset(long)This method returns the offset of this time zone from UTC at the specified date.


getOffset(int, int, int, int, int, int)This method gets the time zone offset, for the current date, modified in case of daylight savings.


getRawOffset()This method returns the amount of time in milliseconds to add to UTC to get standard time in this time zone.


TimeZone.getTimeZone(String)This method gets the TimeZone for the given ID.


TimeZone.getTimeZone(ZoneId)This method gets the TimeZone for the given zoneId.


hasSameRules(TimeZone)This method returns true if this zone has the same rule and offset as another zone.


inDaylightTime(Date)This method queries if the given date is in Daylight Saving Time in this time zone.


observesDaylightTime()This method 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.


TimeZone.setDefault(TimeZone)This method sets the TimeZone that is returned by the getDefaultmethod. the zone is cached.


setID(String)This method sets the time zone ID.


setRawOffset(int)This method sets the base time zone offset to GMT. 


toZoneId()This method converts this TimeZone object to a ZoneId.


useDaylightTime()This method queries if this TimeZone uses Daylight Saving Time.


No comments:

Post a Comment