Prash's Blog

Get Java Timezone list September 8, 2012

Filed under: Java — prazjain @ 7:48 pm
Tags: ,

If you have had same problem as me and you needed to know the java timezone id / name for a particular city / country and could not figure that out.
Here is a code snippet that can help you do that.

import java.util.*;

public class TestZones
{
	public static void main(String[] args)
	{
		for (String string : TimeZone.getAvailableIDs(TimeZone.getTimeZone("GMT+08:00").getRawOffset())) 
		{
    			System.out.println(string);
		}
	}
}
Advertisements
 

One Response to “Get Java Timezone list”


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s