SimpleDateFormat.setDateFormatSymbols(DateFormatSymbols newFormatSymbols) has the following syntax.
public void setDateFormatSymbols(DateFormatSymbols newFormatSymbols)
In the following code shows how to use SimpleDateFormat.setDateFormatSymbols(DateFormatSymbols newFormatSymbols) method.
//from w w w .j ava 2s . com import java.text.DateFormatSymbols; import java.text.SimpleDateFormat; import java.util.Date; public class Main { 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())); } }
The code above generates the following result.