Java Day of Week weekDay(final Date date)

Here you can find the source of weekDay(final Date date)

Description

week Day

License

Apache License

Declaration

public static int weekDay(final Date date) 

Method Source Code


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

import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import static java.util.Calendar.*;

public class Main {
    public static int weekDay(final Date date) {
        return fromDateToCalendar(date).get(DAY_OF_WEEK);
    }// w  w w .  ja v  a2s .  com

    public static Calendar fromDateToCalendar(final Date date) {
        final Calendar cal = new GregorianCalendar();
        cal.clear();
        cal.setMinimalDaysInFirstWeek(4);
        cal.setFirstDayOfWeek(Calendar.MONDAY);
        cal.setTime(date);

        return cal;
    }
}

Related

  1. startOfWeek(Date date)
  2. toStartWeek(Date date)
  3. toWeekDayUS(Date date, int expect)
  4. truncDateToIsoWeek(Date d)
  5. weekCount(Date start, Date end)
  6. weekDaysBetween(final Date a, final Date b)
  7. WeekOfTheYear(Date dt)
  8. weekOfYear(Date date)
  9. weeksBetween(Date date1, Date date2)