I m using Joda Time, and I m being passed DateTimeZones that are created using DateTimeZone.forOffsetHours()
. I d like to print these timezones using standard timezone acronyms such as "PST", "EST", etc.
However, whenever I print DateTimes that use these timezones, I get an "hh:mm" representation of the timezone instead of the name acronym.
Here s an example:
public class tmp {
public static void main( String args[] ) {
// "PST"
System.out.println( DateTimeFormat.forPattern("z").print( new DateTime() ) );
// "PST"
System.out.println( DateTimeFormat.forPattern("z").print( new DateTime( DateTimeZone.forTimeZone( TimeZone.getTimeZone("PST")) )) );
// "-08:00"
System.out.println( DateTimeFormat.forPattern("z").print( new DateTime( DateTimeZone.forOffsetHours(-8) )) );
}
}
Is there a way to print out the appropriate timezone acronym in the last example using Joda Time?