Java DateFormatSymbols getMonths() Example

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


Syntax is : public String[] getMonths()
Method returns month strings. For example: "January", "February", etc.

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

class GetMonthsDateFormatSymbols {

    public static void main(String[] args) {

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

        // getMonths() method call.
        String[] months = dFormatSymbols.getMonths();
        System.out.println("Months of date format symbol : ");
        for (int i = 0; i < months.length; i++) {
            System.out.println(months[i]);
        }
    }
}

Output of the program.
Months of date format symbol :
January
February
March
April
May
June
July
August
September
October
November
December

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

HOME | COPYRIGHT | CONTACT US