Here you can find the source of getDayNames(Locale locale)
Parameter | Description |
---|---|
locale | a parameter |
public static List<String> getDayNames(Locale locale)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.List; import java.util.Locale; public class Main { /**/* w w w. jav a 2 s . c o m*/ * Returns a List of day name Strings - suitable for calendar headings. * * @param locale * @return List of day name Strings */ public static List<String> getDayNames(Locale locale) { Calendar tempCal = Calendar.getInstance(locale); tempCal.set(Calendar.DAY_OF_WEEK, tempCal.getFirstDayOfWeek()); SimpleDateFormat dateFormat = new SimpleDateFormat("EEEE", locale); List<String> resultList = new ArrayList<String>(); for (int i = 0; i < 7; i++) { resultList.add(dateFormat.format(tempCal.getTime())); tempCal.roll(Calendar.DAY_OF_WEEK, 1); } return resultList; } }