SimpleDateFormat: setDateFormatSymbols(DateFormatSymbols newFormatSymbols) : SimpleDateFormat « java.text « Java by API





SimpleDateFormat: setDateFormatSymbols(DateFormatSymbols newFormatSymbols)

 

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 SimpleDateFormat('hh:mm:ss')
2.new SimpleDateFormat('dd MMM yyyy hh:mm:ss zzz')
3.new SimpleDateFormat('E MMM dd yyyy')
4.new SimpleDateFormat('yyyy-MM-dd')
5.new SimpleDateFormat(String pattern, Locale locale)
6.SimpleDateFormat: applyPattern(String pattern)
7.SimpleDateFormat: format(Date d)
8.SimpleDateFormat: parse(String text, ParsePosition pos)