Java DateFormatSymbols getShortMonths() Example

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


Syntax is : public String[] getShortMonths()
Method returns short month strings. For example: "Jan", "Feb", etc.

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

class GetShortMonthsDateFormatSymbols {

    public static void main(String[] args) {

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

        // getShortMonths() method call.
        String[] months = dFormatSymbols.getShortMonths();
        System.out.println("Months in short form : ");
        for (int i = 0; i < months.length; i++) {
            System.out.println(months[i]);
        }
    }
}

Output of the program.
 Months in short form :
Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec

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

HOME | COPYRIGHT | CONTACT US