Example usage for java.text SimpleDateFormat getDateFormatSymbols

List of usage examples for java.text SimpleDateFormat getDateFormatSymbols

Introduction

In this page you can find the example usage for java.text SimpleDateFormat getDateFormatSymbols.

Prototype

public DateFormatSymbols getDateFormatSymbols() 

Source Link

Document

Gets a copy of the date and time format symbols of this date format.

Usage

From source file:MainClass.java

public static void main(String args[]) throws Exception {
    SimpleDateFormat sdf = new SimpleDateFormat();
    DateFormatSymbols dfs = sdf.getDateFormatSymbols();

    String era[] = { "BCE", "CE" };
    dfs.setEras(era);/*  w w w  .  j a va 2  s . com*/
    sdf.setDateFormatSymbols(dfs);

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

From source file:ChangeEra.java

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

    String era[] = { "BCE", "CE" };
    dfs.setEras(era);/* ww  w  . ja va 2s  . co  m*/
    sdf.setDateFormatSymbols(dfs);

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

From source file:Main.java

public static void main(String[] args) throws Exception {
    SimpleDateFormat formatter = new SimpleDateFormat();

    String date = formatter.format(new Date());
    System.out.println(formatter.getDateFormatSymbols().getLocalPatternChars());
    System.out.println("date = " + date);
}