Get the current TimeZone using the Calendar class

This example shows how to get and display the current timezone using the Calendar class.
First we create a Calendar instance using the static method getInstance(). Then call the getTimeZone() method to get a TimeZone object.
Finally we call the getDisplayName() method which returns the current timezone as a string, which we send to System.out.

Search for more Java info on this site here:
Custom Search

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">