Example usage for com.google.gwt.user.datepicker.client CalendarUtil getStartingDayOfWeek

List of usage examples for com.google.gwt.user.datepicker.client CalendarUtil getStartingDayOfWeek

Introduction

In this page you can find the example usage for com.google.gwt.user.datepicker.client CalendarUtil getStartingDayOfWeek.

Prototype

public static int getStartingDayOfWeek() 

Source Link

Document

Returns the day of the week on which week starts in the current locale.

Usage

From source file:org.unitime.timetable.gwt.client.events.SingleDateSelector.java

License:Apache License

static int startingDayOfWeek() {
    return (6 + CalendarUtil.getStartingDayOfWeek()) % 7;
}

From source file:org.unitime.timetable.gwt.client.events.SingleDateSelector.java

License:Apache License

@SuppressWarnings("deprecation")
static int weekNumber(int year, int month) {
    Date d = new Date(year - 1900, month - 1, 1);
    while (d.getDay() != CalendarUtil.getStartingDayOfWeek())
        d.setDate(d.getDate() - 1);/*from   www  . j ava  2s .  c o m*/
    int y = d.getYear();
    int week = 0;
    while (d.getYear() == y) {
        d.setDate(d.getDate() - 7);
        week += 1;
    }
    return week;
}

From source file:stroom.widget.customdatebox.client.CustomCalendarModel.java

License:Apache License

/**
 * Gets the first day of the first week in the currently specified month.
 *
 * @return the first day//from   w ww  . ja va  2  s  .com
 */
public Date getCurrentFirstDayOfFirstWeek() {
    int wkDayOfMonth1st = currentMonth.getDay();
    int start = CalendarUtil.getStartingDayOfWeek();
    if (wkDayOfMonth1st == start) {
        // Always return a copy to allow SimpleCalendarView to adjust first
        // display date
        return new Date(currentMonth.getTime());
    } else {
        Date d = new Date(currentMonth.getTime());
        int offset = wkDayOfMonth1st - start > 0 ? wkDayOfMonth1st - start
                : DAYS_IN_WEEK - (start - wkDayOfMonth1st);
        CalendarUtil.addDaysToDate(d, -offset);
        return d;
    }
}