Example to get available TimeZone with
java.util.TimeZone class.
|
Get available TimeZone |
package java_timezone;
import java.util.TimeZone;
/**
*
* @web http://java-buddy.blogspot.com/
*/
public class Java_TimeZone {
public static void main(String[] args) {
System.out.println("Default TimeZone: " +
TimeZone.getDefault().getDisplayName());
String[] availableIDs = TimeZone.getAvailableIDs();
System.out.println("number of available TimeZone IDs: " +
availableIDs.length);
for (String id : availableIDs){
System.out.println(
"ID: " + id +
" | " + TimeZone.getTimeZone(id).getDisplayName());
}
}
}
No comments:
Post a Comment