Created
March 29, 2019 13:49
-
-
Save ShanikaNishadhi/8c9884cd0c742bdfb5b0724a528c266c 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.util.Locale; | |
import java.text.NumberFormat; | |
import java.text.DateFormat; | |
import java.util.Date; | |
class Main { | |
public static void main(String[] args) { | |
Locale deLocale = new Locale("de","De"); | |
Locale usLocale = new Locale("en","US"); | |
long number = 123456789L; | |
NumberFormat denf = NumberFormat.getInstance(deLocale); | |
NumberFormat usnf = NumberFormat.getInstance(usLocale); | |
System.out.println( denf.format(number) ); | |
System.out.println( usnf.format(number) ); | |
Date now = new Date(); | |
DateFormat usdf = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, usLocale); | |
DateFormat dedf = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, deLocale); | |
System.out.println( usdf.format(now) ); | |
System.out.println( dedf.format(now) ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment