We're displaying the short format/abbreviations for timezones in our application. We've started having users in Australia and are now having issues correctly displaying the abbreviation for those users timezones. Instead of displaying AEST (per http://www.timeanddate.com/library/abbreviations/timezones/) the timezone is showing as EST. How do we get AEST to display, we don't have the space to show the long format, which in this case would be 'Eastern Standard Time (Queensland)'.
Code Sample:
final DateTimeFormatter shortFormatter = DateTimeFormat.forPattern("M/d/yyyy HH:mm z");
final DateTimeFormatter longFormatter = DateTimeFormat.forPattern("M/d/yyyy HH:mm zzzz");
final DateTimeZone timezone = DateTimeZone.forID("Australia/Brisbane");
final Instant instant = new Instant();
// Produces 5/2/2014 01:27 EST (want AEST)
System.out.println(shortFormatter.withZone(timezone).print(instant));
// Produces 5/2/2014 01:27 Eastern Standard Time (Queensland)
System.out.println(longFormatter.withZone(timezone).print(instant));
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The EST comes from the IANA database files which are compiled into the joda-time jar. If you change the australasia file from EST to AEST and recompile joda-time as per http://www.joda.org/joda-time/tz_update.html you should have the desired effect.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
We're displaying the short format/abbreviations for timezones in our application. We've started having users in Australia and are now having issues correctly displaying the abbreviation for those users timezones. Instead of displaying AEST (per http://www.timeanddate.com/library/abbreviations/timezones/) the timezone is showing as EST. How do we get AEST to display, we don't have the space to show the long format, which in this case would be 'Eastern Standard Time (Queensland)'.
Code Sample:
final DateTimeFormatter shortFormatter = DateTimeFormat.forPattern("M/d/yyyy HH:mm z");
final DateTimeFormatter longFormatter = DateTimeFormat.forPattern("M/d/yyyy HH:mm zzzz");
final DateTimeZone timezone = DateTimeZone.forID("Australia/Brisbane");
final Instant instant = new Instant();
// Produces 5/2/2014 01:27 EST (want AEST)
System.out.println(shortFormatter.withZone(timezone).print(instant));
// Produces 5/2/2014 01:27 Eastern Standard Time (Queensland)
System.out.println(longFormatter.withZone(timezone).print(instant));
The EST comes from the IANA database files which are compiled into the joda-time jar. If you change the australasia file from EST to AEST and recompile joda-time as per http://www.joda.org/joda-time/tz_update.html you should have the desired effect.
Thanks, we'll give that a try