DateFormatSymbols: setEras(String[] newEras) : DateFormatSymbols « java.text « Java by API






DateFormatSymbols: setEras(String[] newEras)

 

import java.text.DateFormatSymbols;
import java.text.SimpleDateFormat;
import java.util.Date;

public class MainClass {
  public static void main(String args[]) throws Exception {
    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

1.new DateFormatSymbols(Locale loc)
2.DateFormatSymbols: getMonths()
3.DateFormatSymbols: getShortWeekdays()
4.DateFormatSymbols: getWeekdays()
5.DateFormatSymbols: setShortWeekdays(String[] newShortWeekdays)