Java DateFormatSymbols getEras() Example

DateFormatSymbols class getEras() method example. This example shows you how to use getEras() method.


Syntax is : public String[] getEras()
This method returns era strings. For example: "AD" and "BC".

Here is the code.
/**
 * @(#) GetErasDateFormatSymbols.java
 * A class representing use of method getEras() of DateFormatSymbols
class in java.text Package.
 * @Version  14-May-2008
 @author   Rose India Team
 */
import java.text.*;

class GetErasDateFormatSymbols {

    public static void main(String[] args) {

        // Create new DateFormatSymbols object.
        DateFormatSymbols dFormatSymbols = DateFormatSymbols.getInstance();

        // getEras method call for DateFormatSymbols object.
        String[] era = dFormatSymbols.getEras();
        System.out.println("Avalable Era : ");
        for (int i = 0; i < era.length; i++) {
            System.out.println(era[i"   ");
        }
    }
}

Output of the program.
Avalable Era :
BC   
AD 

Post Comment
Name:
E-mail:
Contact no :
Comments:
  Refresh Image
Verify Image:
 
 
Your Comment's
 
 
 

HOME | COPYRIGHT | CONTACT US