Java Week Day getDayOfWeek(Date date)

Here you can find the source of getDayOfWeek(Date date)

Description

get Day Of Week

License

Apache License

Declaration

public static String getDayOfWeek(Date date) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.Calendar;
import java.util.Date;

public class Main {

    public static String getDayOfWeek(Date date) {
        String[] weekDays = { "SUNDAY", "MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", "SATURDAY" };
        Calendar cal = Calendar.getInstance();
        cal.setTime(date);//from  w ww .j  a  va  2  s.c  o m
        int w = cal.get(Calendar.DAY_OF_WEEK) - 1;
        if (w < 0)
            w = 0;
        return weekDays[w];
    }
}

Related

  1. getDay(long date, int startOfWeek, int increment)
  2. getDayNextWeek()
  3. getDayOfTheWeekFromNow(int nDays)
  4. getDayOfWeek()
  5. getDayOfWeek(Date date)
  6. getDayOfWeek(Date date)
  7. getDayOfWeek(Date date)
  8. getDayOfWeek(Date date)
  9. getDayOfWeek(Date date, int day)