Time Zone: Time Zone is the specified part of the earth that holds the special standard of the time i.e. termed as local time. Usually time zone is based on the GMT (Greenwich Mean Time). Each and every part of the earth has categorized for holding it's own time zones that had been fixed according to the rotation of the earth on it's own base.
Most application software uses the underlying operating system for getting all information about the time zones for setting up the time according to the appropriate time zones. Java maintains it's own time zones database as well as the operating system database. There need to update the java time zone database from the operating system database when it is changed.
DST (Daylight Saving Time): Daylight Saving Time is also called the summer time somewhere in many countries. In this period the sun rises in the morning and sets in the evening one hour later. So, the evening became one hour longer. Benefit of the period is saving energy because in this period artificial light is less needed during the evening. To make DST work, when DST begins, clocks have to be adjusted one hour ahead and adjusted one hour back to standard time every autumn. Many countries maintain the DST and many do not.
Up to now, most of the United States have observed Daylight Saving Time from the first Sunday of April at 2:00 am to the last Sunday of October at 2:00 am. In 2007, most of the U.S. will begin Daylight Saving Time from the second Sunday of March at at 2:00 a.m. and revert to standard time on the first Sunday in November. In the U.S., each time zone switches at a different time.
In this section, the given program shows you how to get about all the information for the time zones. This program shows all time zones available in the world with the Time Zone ID, Time Zone Name and it's fixed GMT (India Standard Time : 5:30).
This class is used to getting and setting the time zone. You can get the default time zone using the getDefault() method i.e. the time zone on where your program is running.
Above method returns a array of all time zone ids like the time zone id for the time zone of India is Asia/Calcutta.
Above method returns the full name of the Time Zone. The time zone id, which full name has to be found, is passed through the method as a parameter.
Above code of the program represents two methods and a field of the TimeZone class these are explained as follows:
Above method returns the amount of time to add UTC () to get standard time for the specified time zone. This method returns the static integer value which is the amount of time in millisecond.
This method returns the absolute number for the given number. The number, which has to become absolute, is passed through the method as a parameter.
Here is the code of the program:
Posted on: April 16, 2007 If you enjoyed this post then why not add us on Google+? Add us to your Circles