Java Program get weekdays names


This Java example will show you how to get weekdays names

import java.text.SimpleDateFormat;
import java.text.DateFormatSymbols;

public class Main {
   public static void main(String[] args) {
      String[] weekdays = new DateFormatSymbols().getWeekdays();
      
      for (int i = 2; i < (weekdays.length-1); i++) {
         String dayname = weekdays[i];
         System.out.println("weekday Name = " + dayname);
      }
   }
}

 

Output:

weekday Name = Monday
weekday Name = Tuesday
weekday Name = Wednesday
weekday Name = Thursday
weekday Name = Friday 

 


Subscribe For Daily Updates

JAVA File IO examples

JAVA Date & Time Progamming Examples

JAVA Collections

Flutter Questions
Android Questions