Example usage for java.util Calendar DAY_OF_WEEK

List of usage examples for java.util Calendar DAY_OF_WEEK

Introduction

In this page you can find the example usage for java.util Calendar DAY_OF_WEEK.

Prototype

int DAY_OF_WEEK

To view the source code for java.util Calendar DAY_OF_WEEK.

Click Source Link

Document

Field number for get and set indicating the day of the week.

Usage

From source file:Main.java

public static int getWeekDay() {
    return getCalendar(getCurrentDate()).get(Calendar.DAY_OF_WEEK);
}

From source file:Main.java

public static int getTodayPlus() {
    Calendar cd = Calendar.getInstance();

    int ret = cd.get(Calendar.DAY_OF_WEEK);
    if (ret == Calendar.SUNDAY)
        return 6;
    //// w  w w  . j  a  v a 2 s  . co m
    return cd.get(Calendar.DAY_OF_WEEK) - 2;// - 1
}

From source file:Main.java

public static int getCurrentDayOfWeek() {
    Calendar calendar = Calendar.getInstance();
    return calendar.get(Calendar.DAY_OF_WEEK);
}

From source file:Main.java

public static void setToFirstDayInWeek(Calendar calendar) {
    calendar.set(Calendar.DAY_OF_WEEK, 1);
    calendar.getTimeInMillis();
}

From source file:Main.java

public static int getDayOfWeek() {
    return calendar.get(Calendar.DAY_OF_WEEK);
}

From source file:Main.java

public static Date getNextDate(int days) {
    Calendar c = Calendar.getInstance();
    c.add(Calendar.DAY_OF_WEEK, days);
    return c.getTime();
}

From source file:Main.java

private static void prepareCalendarNoSunday(Calendar calendar) {
    if (calendar.get(Calendar.DAY_OF_WEEK) == calendar.SUNDAY) {
        calendar.add(Calendar.DATE, 1);
    }//from w  w w. ja va  2 s . c om
}

From source file:Main.java

public static int getCurrentDayOfWeekFromTimestamp() {
    Calendar currentTime = Calendar.getInstance();
    return currentTime.get(Calendar.DAY_OF_WEEK);
}

From source file:Main.java

public static int getIsFristWeek() {
    Calendar cal = Calendar.getInstance();
    int date = cal.get(Calendar.DAY_OF_WEEK);
    Log.e("WeekDay", "" + date);
    return date;/*from  w w  w  . j a v a  2  s . c  om*/
}

From source file:Main.java

public static int getWeekInChina(Calendar calendar) {
    int week = calendar.get(Calendar.WEEK_OF_YEAR);
    int day = calendar.get(Calendar.DAY_OF_WEEK);
    if (day == 1) {
        week = week - 1;//from   ww  w .  j  a  v a 2s .  c om
    }
    return week;
}