Formatting Messages: Change Era : Message Format « I18N « Java

Formatting Messages: Change Era

Formatting Messages: Change Era

Java Internationalization
By Andy Deitsch, David Czarnecki

ISBN: 0-596-00019-7
import java.text.*;
import java.util.Date;

public class ChangeEra {
  public static void main(String s[]) {
    SimpleDateFormat sdf = new SimpleDateFormat();
    DateFormatSymbols dfs = sdf.getDateFormatSymbols();

    String era[] = { "BCE", "CE" };

    sdf.applyPattern("MMMM d yyyy G");
    System.out.println(sdf.format(new Date()));

Related examples in the same category

1.Formatting Messages: Date and NumberFormatting Messages: Date and Number
2.Set MessageFormat to Locale.USSet MessageFormat to Locale.US
3.Date Number SampleDate Number Sample
4.Message Format for sentence
5.Java I18N: Format : Message Format DemoJava I18N: Format : Message Format Demo
6.Formatting Messages: Arabic DigitFormatting Messages: Arabic Digit
7.Formatting Messages: Message Format ReuseFormatting Messages: Message Format Reuse
8.A text format similar to MessageFormat but using string rather than numeric keys.
9.Given a message and parameters, resolve all message's parameter placeholders with the parameter value.