Created
July 21, 2015 19:56
-
-
Save jarrodhroberson/dfb72f1b7e407c19ab77 to your computer and use it in GitHub Desktop.
Dump TimeZone Information with an example of the current time in ISO8601 FULL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.text.SimpleDateFormat; | |
import java.util.Date; | |
import java.util.TimeZone; | |
import javax.annotation.Nonnull; | |
public class TimeZoneInfo | |
{ | |
public static void main(@Nonnull final String[] args) | |
{ | |
final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX"); | |
final Date now = new Date(); | |
System.out.println("ID (DISPLAY NAME) EXAMPLE"); | |
for (final String id : TimeZone.getAvailableIDs()) | |
{ | |
final TimeZone tz = TimeZone.getTimeZone(id); | |
sdf.setTimeZone(tz); | |
System.out.println(String.format("%s (%s) %s",id, tz.getDisplayName(), sdf.format(now))); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment