Results 1 to 4 of 4

Thread: Source Code to get all the available time zones with using java

  1. #1
    Join Date
    Nov 2009
    Posts
    678

    Source Code to get all the available time zones with using java

    Hi, can anyone have an idea which will give you the all available timezones with the help of java? I want to do it in java. If you have source code regarding this in another language then also do. Please, reply me as soon as possible.

  2. #2
    Join Date
    Oct 2005
    Posts
    2,393

    Re: Source Code to get all the available time zones with using JAVA

    HI, I don't know how to do this. But, I have come to know the some of the following methods of java.util clas TimeZone as follows:

    Last edited by Reegan; 30-11-2009 at 10:13 AM.

  3. #3
    Join Date
    May 2008
    Posts
    2,389

    Re: Source Code to get all the available time zones with using java

    Hi, to Retrieve Information on All Available Time Zones you need to use the following example which will lists all time zones known by the Java Development Kit.

    Code:
     Date today = new Date();    
        String[] zoneIds = TimeZone.getAvailableIDs();
            for (int i=0; i<zoneIds.length; i++) 
            {
            TimeZone tz = TimeZone.getTimeZone(zoneIds[i]);
            String shortName = tz.getDisplayName(tz.inDaylightTime(today), TimeZone.SHORT);
            String longName = tz.getDisplayName(tz.inDaylightTime(today), TimeZone.LONG);
            int rawOffset = tz.getRawOffset();
            int hour = rawOffset / (60*60*1000);
            int min = Math.abs(rawOffset / (60*1000)) % 60;
            boolean hasDST = tz.useDaylightTime();
            boolean inDST = tz.inDaylightTime(today);
        }

  4. #4
    Join Date
    Feb 2008
    Posts
    1,852

    Re: Source Code to get all the available time zones with using java

    HI, this is the best and simple example in java which will give you the all available time zones. I don't think that it needs explanation.

    Code:
    import java.util.TimeZone;
    
    public class AllTimeZones
    {
      public static void main(String args[])
       {
        String[] ID= TimeZone.getAvailableIDs();
        for(int i=0;i<ID.length;i++)
        {
          System.out.println("TimeZone ["+(i+1)+"] ==>"+
          TimeZone.getTimeZone(ID[i]));
        }
      }
    }
    List of all the available Time zones ID in JDK :

Similar Threads

  1. can i get c to java converter source code
    By aaron_geo in forum Software Development
    Replies: 2
    Last Post: 19-03-2011, 11:06 AM
  2. Where to download Java EE 5 sdk source code
    By Lohitaksha in forum Software Development
    Replies: 6
    Last Post: 24-07-2010, 12:02 AM
  3. Where can I find Java 1.5 swing (JTabbedPane class) source code
    By Who is it in forum Software Development
    Replies: 5
    Last Post: 23-07-2010, 03:35 AM
  4. Java Source Code From Compiled Binary CLASS Files
    By Layton in forum Windows Software
    Replies: 4
    Last Post: 20-03-2010, 08:54 PM
  5. How to hide source code in JAVA
    By Jacek in forum Software Development
    Replies: 4
    Last Post: 11-05-2009, 09:42 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,268,778.69960 seconds with 17 queries