Skip to content

Instantly share code, notes, and snippets.

@kirilloid
Created March 15, 2017 15:36
Show Gist options
  • Save kirilloid/794246a38e5f347af7514dea0a7b9064 to your computer and use it in GitHub Desktop.
Save kirilloid/794246a38e5f347af7514dea0a7b9064 to your computer and use it in GitHub Desktop.
import java.util.Locale;
import java.util.Date;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
public class HelloWorld
{
public static void main(String[] args)
{
Locale hiDflt = Locale.forLanguageTag("hi-IN");
Locale hiDeva = Locale.forLanguageTag("hi-IN-u-nu-deva");
Locale hiLatn = Locale.forLanguageTag("hi-IN-u-nu-latn");
DateFormat df_hiDflt = SimpleDateFormat.getTimeInstance(DateFormat.SHORT, hiDflt);
DateFormat df_hiDeva = SimpleDateFormat.getTimeInstance(DateFormat.SHORT, hiDeva);
DateFormat df_hiLatn = SimpleDateFormat.getTimeInstance(DateFormat.SHORT, hiLatn);
System.out.println("date (" + hiDflt.getUnicodeLocaleType("nu") + "): " + df_hiDflt.format(new Date()));
System.out.println("date (" + hiDeva.getUnicodeLocaleType("nu") + "): " + df_hiDeva.format(new Date()));
System.out.println("date (" + hiLatn.getUnicodeLocaleType("nu") + "): " + df_hiLatn.format(new Date()));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment