Core Java| JSP| Servlets| XML| EJB| JEE5| Web Services| J2ME| Glossary| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials

Latest Questions
Comments
 
Get Time Zone 
 

Time Zone class inherits from a Java.util.time zone. This class represents a time zone offset.

 

Get Time Zone

                         

Time Zone class inherits from a Java.util.time zone. This class represents a time zone offset. The Time zone gives you a specific time zone of a specific locale where the program is running. In case a program running in USA,This class creates a time zone object based on USA.

Understand with Example

In this Tutorial we want to describe you a code that help you in understanding a Get Time Zone. For this we have a Class name Get Time Zone. Inside the main method  the calendar class call a get Instance  ( ) method returns you the default zone and locale and  in order to get an instance of calendar class in a  calendar object. The calendar object calls  getTimeZone method  and return the calendar current's time of the zone by System.out.println. method.  Time Zone ( ) is a static  method that return you all the Id supported. Date Format is a abstract class used for date, time  formatting class.

Date Format df   = DateFormat.getDateInstance( )  - The DateFormat.getDateInstance returns you the date for the different  locale. This provides you to get the time format for a specified country.

The System.out.println print the time zone  for a given id .

GetTimeZone.java

import java.util.*;
import java.text.*;

public class GetTimeZone {

    public static void main(String args[]) {

        Calendar calendar = Calendar.getInstance();
        TimeZone timeZone = calendar.getTimeZone();

        System.out.println("Time Zone :" + timeZone.getID());

        DateFormat df = DateFormat.getDateInstance();
        System.out.println("Time Zone :" + df.getTimeZone().getID());
    }
}

Output
Time Zone :GMT+05:30
Time Zone :GMT+05:30
Download code

                         

» View all related tutorials
Related Tags: c class ant help property get tutorial name ria this for to e des pe in as sta m nt

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Training Courses
Tell A Friend
Your Friend Name
Software Solutions
Least Viewed
Most Rated
Recently Viewed
Search Tutorials

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.