Skip to content

Instantly share code, notes, and snippets.

@omajid
Last active January 26, 2016 22:24
Show Gist options
  • Save omajid/5ceab931ced332a3d72c to your computer and use it in GitHub Desktop.
Save omajid/5ceab931ced332a3d72c to your computer and use it in GitHub Desktop.
import java.text.DateFormat;
import java.util.Date;
import java.util.Locale;
public class TimeZoneTest {
public static void main(String[] args) {
Locale[] locales = DateFormat.getAvailableLocales();
Date now = new Date();
for (Locale locale : locales) {
String fullTime = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL, locale).format(now);
String longTime = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.LONG, locale).format(now);
String mediumTime = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.MEDIUM, locale).format(now);
String shortTime = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.SHORT, locale).format(now);
System.out.format("%s\t%s\t%s\t%s\t%s%n", locale.toLanguageTag(), fullTime, longTime, mediumTime, shortTime);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment