Java Week Day getDayOfWeek()

Here you can find the source of getDayOfWeek()

Description

get Day Of Week

License

Open Source License

Return

int (day of week 1 = SUNDAY , ... 7 = SATURDAY)

Declaration

public static int getDayOfWeek() 

Method Source Code

//package com.java2s;
/*//w ww. j a va  2s  .  co  m
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

import java.util.Calendar;

import java.util.Locale;

public class Main {
    /**
     * @return int (day of week 1 = SUNDAY , ... 7 = SATURDAY)
     * @example int day = DateUtils.getDayOfWeek()
     */
    public static int getDayOfWeek() {
        Calendar date = Calendar.getInstance(Locale.US);
        return date.get(Calendar.DAY_OF_WEEK);
    }

    /**
     * @return int (day of week 1 = SUNDAY , ... 7 = SATURDAY)
     * @example int day = DateUtils.getDayOfWeek(String date)
     * @parameter yyyymmddhhmmss ex. "20070101120500" , "20530101120500"
     */
    public static int getDayOfWeek(Calendar date) {
        return date.get(Calendar.DAY_OF_WEEK);
    }
}

Related

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