Java DateFormatSymbols get month name String

Description

Java DateFormatSymbols get month name String

import java.text.DateFormatSymbols;
import java.util.Calendar;

public class Main {

  public static void main(String[] args) {
    Calendar gCal = Calendar.getInstance();

    int v = gCal.get(Calendar.MONTH);

    // Create new DateFormatSymbols instance to obtain 
    //the String value for dates
    DateFormatSymbols symbols = new DateFormatSymbols();
    String[] days = symbols.getMonths();
    System.out.println(days[v]);//from  ww  w . ja va  2 s .c om

  }
}



PreviousNext

Related