Last active
January 26, 2016 22:24
-
-
Save omajid/5ceab931ced332a3d72c to your computer and use it in GitHub Desktop.
This file contains 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.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