Java Tutorial/I18N/DateFormatSymbols

Материал из Java эксперт
Перейти к: навигация, поиск

An alternate way to get week days symbols

import java.text.DateFormatSymbols;
import java.util.Calendar;
public class Main {
  public static void main(String[] args) {
    String dayNames[] = new DateFormatSymbols().getWeekdays();
    Calendar date2 = Calendar.getInstance();
    System.out.println("Today is a " + dayNames[date2.get(Calendar.DAY_OF_WEEK)]);
  }
}