Java TimeZone ClassJava TimeZone class represents a time zone offset, and also figures out daylight savings. It inherits the Object class. Java TimeZone class declarationLet's see the declaration of java.util.TimeZone class. Methods of Java TimeZone
Java TimeZone class Example: getAvailableIDs()FileName: TimeZoneExample1.java Test it NowOutput: In TimeZone class available Ids are: Africa/Abidjan Africa/Accra Africa/Addis_Ababa Africa/Algiers Africa/Asmara Africa/Asmera Africa/Bamako Africa/Bangui Africa/Banjul Africa/Bissau and so on .... Java TimeZone class Example: getOffset()FileName: TimeZoneExample2.java Test it NowOutput: The Offset value of TimeZone: 19800000 Java TimeZone class Example: getID()FileName: TimeZoneExample3.java Test it NowOutput: Value of ID is: Asia/Kolkata Java TimeZone class Example: getDisplayName()FileName: TimeZoneExample4.java Test it NowOutput: Display name for default time zone: India Standard Time Java TimeZone class Example: getDefault()Let's see the working of the getDefault() method. FileName: GetDefaultExample.java Output: The ID of the default TimeZone is: GMT Java TimeZone class Example: setID()Let's see the working of the setID() method. FileName: SetIDExample.java Output: The Time zone ID is: GMT + 07:01
Next TopicJava DateFormat
|