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);
		}
	}
}