Formatting Messages: Change Era
/*
Java Internationalization
By Andy Deitsch, David Czarnecki
ISBN: 0-596-00019-7
O'Reilly
*/
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" };
dfs.setEras(era);
sdf.setDateFormatSymbols(dfs);
sdf.applyPattern("MMMM d yyyy G");
System.out.println(sdf.format(new Date()));
}
}
Related examples in the same category