Here is my code that shows the Joda Time error:
import org.joda.time.Period;
import org.joda.time.format.PeriodFormat;
import org.joda.time.format.PeriodFormatter;
import java.util.Locale;
public class ScratchSpace {
public static void main(String[] args) {
Locale.setDefault(Locale.GERMAN);
final PeriodFormatter periodFormatter =
PeriodFormat.wordBased(Locale.ENGLISH);
final Period period = new Period(6, 5, 4, 3);
final String s = period.toString(periodFormatter);
System.out.println("s = " + s);
}
}
According to JavaDocs, I have to get a period formatted in English. But instead, the current default standard is used, which in the example above is German.
I use Joda Time 2.0 on Mac OS X 10.7, and my preferred language is Australian English.
Can anyone offer any simple job?
source
share