Example usage for java.util Calendar SATURDAY

List of usage examples for java.util Calendar SATURDAY

Introduction

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

Prototype

int SATURDAY

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

Click Source Link

Document

Value of the #DAY_OF_WEEK field indicating Saturday.

Usage

From source file:net.sourceforge.fenixedu.presentationTier.TagLib.sop.examsMapNew.renderers.ExamsMapContentRenderer.java

/**
 * @param infoExam//  w  w w .  j  a  v  a  2 s. c  o  m
 * @return
 */
private boolean atValidHour(InfoExam infoExam) {
    int curricularYear = infoExam.getInfoExecutionCourse().getCurricularYear().intValue();
    int beginning = infoExam.getBeginning().get(Calendar.HOUR_OF_DAY);
    int weekDay = infoExam.getDay().get(Calendar.DAY_OF_WEEK);

    return ((curricularYear == 1 || curricularYear == 2) && (beginning == 9))
            || (curricularYear == 3 && beginning == 17)
            || (curricularYear == 4
                    && (((weekDay == Calendar.TUESDAY || weekDay == Calendar.THURSDAY) && beginning == 17)
                            || (weekDay == Calendar.SATURDAY && beginning == 9)))
            || (curricularYear == 5 && beginning == 13);
}

From source file:dao.Graficos.java

public static Date dia_inicial_final_semana(boolean isPrimeiro) {
    //Seta a data atual.
    Date dataAtual = new Date();
    GregorianCalendar calendar = new GregorianCalendar();
    //Define que a semana comea no domingo.
    calendar.setFirstDayOfWeek(Calendar.SUNDAY);
    //Define a data atual.
    calendar.setTime(dataAtual);/*  w  w  w  . j  ava  2s.c o m*/
    if (isPrimeiro) {
        calendar.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
    } else {
        calendar.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY);
    }
    return calendar.getTime();
}

From source file:com.microsoft.mimickeralarm.model.Alarm.java

public boolean isOneShot() {
    boolean isOneShot = true;
    for (int dayOfWeek = Calendar.SUNDAY; dayOfWeek <= Calendar.SATURDAY; ++dayOfWeek) {
        if (getRepeatingDay(dayOfWeek - 1)) {
            isOneShot = false;/*from   w w  w .jav a 2s .c  om*/
            break;
        }
    }
    return isOneShot;
}

From source file:com.autentia.jsf.component.ocupation.HtmlOcupationCalendarRenderer.java

private int mapCalendarDayToCommonDay(int day) {
    switch (day) {
    case Calendar.TUESDAY:
        return 1;
    case Calendar.WEDNESDAY:
        return 2;
    case Calendar.THURSDAY:
        return 3;
    case Calendar.FRIDAY:
        return 4;
    case Calendar.SATURDAY:
        return 5;
    case Calendar.SUNDAY:
        return 6;
    default:/*from  w w  w .  j a  v a 2 s . c om*/
        return 0;
    }
}

From source file:net.sourceforge.fenixedu.presentationTier.TagLib.sop.examsMapNew.renderers.ExamsMapContentRenderer.java

private boolean onValidWeekDay(InfoExam infoExam) {
    int curricularYear = infoExam.getInfoExecutionCourse().getCurricularYear().intValue();
    int weekDay = infoExam.getDay().get(Calendar.DAY_OF_WEEK);

    return ((curricularYear == 1 || curricularYear == 3 || curricularYear == 5)
            && (weekDay == Calendar.MONDAY || weekDay == Calendar.WEDNESDAY || weekDay == Calendar.FRIDAY))
            || ((curricularYear == 2 || curricularYear == 4) && (weekDay == Calendar.TUESDAY
                    || weekDay == Calendar.THURSDAY || weekDay == Calendar.SATURDAY));
}

From source file:org.squale.welcom.outils.DateUtil.java

/**
 * @param dateDebut : date de dbut (java.util.Date)
 * @param dateFin : date de fin (java.util.Date)
 * @param unit : unit de temps dans laquelle doit tre calcule la dure (MILLI_SEC,SEC,DAY,HOUR,MIN)
 * @return retourne le nombre de jour entre deux dates les samedi et dimanche n'tant pas inclu
 *//*from w  ww.j a v a2 s.  c  o  m*/
public static long durationNoWeekEnd(final java.util.Date dateDebut, final java.util.Date dateFin,
        final long unit) {
    long duration = duration(dateDebut, dateFin, unit);
    final GregorianCalendar gc = new GregorianCalendar();

    if (duration != 0) {
        gc.setTime(dateDebut);

        while (gc.getTime().getTime() <= dateFin.getTime()) {
            if ((gc.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY)
                    || (gc.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY)) {
                duration--;
            }

            gc.add(Calendar.DATE, 1);
        }
    }

    return duration;
}

From source file:com.feilong.core.date.DateUtil.java

/**
 * date <span style="color:red">?()</span> <code>23:59:59.999</code> .
 * //from   w  w  w.ja  v  a2  s  .c  o  m
 * <pre class="code">
 * DateUtil.getLastDateOfThisWeek(2012-10-11 17:10:30.701)   =2012-10-13 23:59:59.999
 * DateUtil.getLastDateOfThisWeek(2014-12-31 05:00:00)       =2015-01-03 23:59:59.999 //
 * </pre>
 * 
 * <h3>?:</h3>
 * <blockquote>
 * <ol>
 * <li>,<span style="color:red">,?</span></li>
 * <li>,?</li>
 * </ol>
 * </blockquote>
 * 
 * @param date
 *            ?
 * @return  <code>date</code> null, {@link NullPointerException}
 * @see #toCalendar(Date)
 * @see Calendar#set(int, int)
 * @see CalendarUtil#resetDayEnd(Calendar)
 * @see Calendar#getTime()
 * @since 1.0.1
 */
public static Date getLastDateOfThisWeek(Date date) {
    Calendar calendar = toCalendar(date);
    calendar.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY);
    return CalendarUtil.toDate(CalendarUtil.resetDayEnd(calendar));
}

From source file:cn.mypandora.util.MyDateUtils.java

/**
 * .//  www.  ja  v  a  2 s  . com
 *
 * @param c
 * @return
 */
public static String getWeekDay(Calendar c) {
    if (c == null) {
        return "";
    }
    switch (c.get(Calendar.DAY_OF_WEEK)) {
    case Calendar.MONDAY:
        return "";
    case Calendar.TUESDAY:
        return "";
    case Calendar.WEDNESDAY:
        return "";
    case Calendar.THURSDAY:
        return "";
    case Calendar.FRIDAY:
        return "";
    case Calendar.SATURDAY:
        return "";
    default:
        return "";
    }
}

From source file:de.feanor.yeoldemensa.data.MensaFactory.java

/**
 * Returns the Date for next Saturday midnight. Used for valiTo in Mensa.
 * //from  w ww.  j a va 2 s .c o  m
 * @return Date of next Saturday
 */
private static Date getNextSaturday() {
    Calendar calendar = Calendar.getInstance();
    int weekday = calendar.get(Calendar.DAY_OF_WEEK);

    calendar.set(Calendar.MINUTE, 0);
    calendar.set(Calendar.HOUR, 0);

    // TODO: Better solved with locales probably
    if (weekday == Calendar.SATURDAY) {
        calendar.add(Calendar.DAY_OF_MONTH, 7);
        return calendar.getTime();
    } else if (weekday == Calendar.SUNDAY) {
        calendar.add(Calendar.DAY_OF_MONTH, 6);
        return calendar.getTime();
    } else {
        calendar.add(Calendar.DAY_OF_MONTH, Calendar.SATURDAY - weekday);
    }

    return calendar.getTime();
}

From source file:com.android.calendar.month.SimpleDayPickerFragment.java

/**
 * Sets up the strings to be used by the header. Override this method to use
 * different strings or modify the view params.
 *//*from   w ww. j a  v a 2s .co  m*/
protected void setUpHeader() {
    mDayLabels = new String[7];
    for (int i = Calendar.SUNDAY; i <= Calendar.SATURDAY; i++) {
        mDayLabels[i - Calendar.SUNDAY] = DateUtils.getDayOfWeekString(i, DateUtils.LENGTH_SHORTEST)
                .toUpperCase();
    }
}