Java Day of Week getDayOfWeek()

Here you can find the source of getDayOfWeek()

Description

get Day Of Week

License

Open Source License

Declaration

public static String getDayOfWeek() 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.text.SimpleDateFormat;
import java.util.Date;

public class Main {
    public static String getDayOfWeek() {
        String dow = "";

        SimpleDateFormat sdf = new SimpleDateFormat("E");
        String day = sdf.format(new Date()).toLowerCase();
        if (day.equals("sun")) {
            dow = "1";
        } else if (day.equals("mon")) {
            dow = "2";
        } else if (day.equals("tue")) {
            dow = "3";
        } else if (day.equals("wed")) {
            dow = "4";
        } else if (day.equals("thu")) {
            dow = "5";
        } else if (day.equals("fri")) {
            dow = "6";
        } else if (day.equals("sat")) {
            dow = "7";
        }/*from w w w.  j a va  2 s . c om*/
        return dow;
    }
}

Related

  1. getDateOfWeek(int year, int weekOfYear, int i)
  2. getDateOfYearWeek(int yearNum, int weekNum, int dayOfWeek)
  3. getDateWeek(String date)
  4. getDay(long date, int startOfWeek, int increment)
  5. getDayAfterGivenDate(Date date, int dayOfWeek)
  6. getDayOfWeek(Date date)
  7. getDayOfWeek(int _year, int _month, int _day)
  8. getDayOfWeek(int year, int month, int day)
  9. getDayOfWeek(int year, int month, int day)