TL;DR
ZonedDateTime.now( ZoneId.of( "America/Montreal" ) )
.format( DateTimeFormatter.ofPattern( "dd/MM/uuuu HH:mm:ss" ) )
23/01/2017 12:34:56
java.time
ThreeTenABP (. ), java.time. -, , , .
. . , - , "" .
continent/region, America/Montreal, Africa/Casablanca Pacific/Auckland. 3-4 , EST IST, , (!).
ZoneId z = ZoneId.of( "America/Montreal" ); // Or ZoneId.systemDefault()
ZonedDateTime zdt = ZonedDateTime.now( z );
DateTimeFormatter, , ZonedDateTime. toLocalized…, .
DateTimeFormatter f = DateTimeFormatter.ofPattern( "dd/MM/uuuu HH:mm:ss" ) ;
String output = zdt.format( f );
23/01/2017 12:34:56
java.time
java.time Java 8 . legacy , java.util.Date, Calendar SimpleDateFormat.
Joda-Time, , java.time.
, . Oracle. Qaru . JSR 310.
java.time?
Joda
: Joda-Time, , java.time.
Joda-Time . DateTimeFormat .
DateTimeFormatter formatter = DateTimeFormat.forStyle( "SM" );
DateTime dateTime = DateTime.now();
String output = formatter.print( dateTime );
, . - , - . "S" , "M" , "L" "F" . "-".
Locale
A Locale , , .
Locale, JVM . , / . , , Locale.getDefault, , .
formatter = formatter.withLocale( Locale.CANADA_FRENCH );