Example usage for java.util Calendar WEDNESDAY

List of usage examples for java.util Calendar WEDNESDAY

Introduction

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

Prototype

int WEDNESDAY

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

Click Source Link

Document

Value of the #DAY_OF_WEEK field indicating Wednesday.

Usage

From source file:Main.java

public static void main(String[] args) {

    Calendar cal = Calendar.getInstance();

    // print current first day of the week
    int day = cal.getFirstDayOfWeek();
    System.out.println("Current first day of the week:" + day);

    // set first day of the week as something else
    cal.setFirstDayOfWeek(Calendar.WEDNESDAY);

    // print altered first day of the week
    day = cal.getFirstDayOfWeek();/*from w ww .  ja  v  a2s.  co m*/
    ;
    System.out.println("Altered first day of the week:" + day);
}

From source file:Main.java

public static void main(String[] args) {
    System.out.printf("%ta, %<tb %<te, %<tY", nextDayOfWeek(Calendar.WEDNESDAY));
}

From source file:Main.java

public static void main(String[] args) {
    Calendar now = Calendar.getInstance();
    System.out.println(now.getTime());

    int dayOfWeek = now.get(Calendar.DAY_OF_WEEK);
    if (Calendar.SUNDAY == dayOfWeek) {
        System.out.println("SUNDAY");
    }/*  w ww .  j av  a2  s .c  o  m*/
    if (Calendar.MONDAY == dayOfWeek) {
        System.out.println("MONDAY");
    }
    if (Calendar.TUESDAY == dayOfWeek) {
        System.out.println("TUESDAY");
    }
    if (Calendar.WEDNESDAY == dayOfWeek) {
        System.out.println("WEDNESDAY");
    }
    if (Calendar.THURSDAY == dayOfWeek) {
        System.out.println("THURSDAY");
    }
    if (Calendar.FRIDAY == dayOfWeek) {
        System.out.println("FRIDAY");
    }
    if (Calendar.SATURDAY == dayOfWeek) {
        System.out.println("SATURDAY");
    }
}

From source file:MainClass.java

public static void main(String args[]) {
    Calendar cal = Calendar.getInstance();
    Date now = new Date();
    cal.setTime(now);//  w w w .  jav  a 2 s. co m
    int dayofweek = cal.get(Calendar.DAY_OF_WEEK);
    if (dayofweek == Calendar.SUNDAY)
        System.out.println("SUNDAY");
    if (dayofweek == Calendar.MONDAY)
        System.out.println("MONDAY");
    if (dayofweek == Calendar.TUESDAY)
        System.out.println("TUESDAY");
    if (dayofweek == Calendar.WEDNESDAY)
        System.out.println("WEDNESDAY");
    if (dayofweek == Calendar.THURSDAY)
        System.out.println("THURSDAY");
    if (dayofweek == Calendar.FRIDAY)
        System.out.println("FRIDAY");
    if (dayofweek == Calendar.SATURDAY) {
        System.out.println("SATURDAY");
    }
}

From source file:Main.java

public static boolean determineAskUserForStart(Calendar calendar) {
    if (calendar.get(Calendar.DAY_OF_WEEK) >= Calendar.WEDNESDAY) {
        return true;
    } else {//from   ww w.  j a v  a 2s.com
        return false;
    }
}

From source file:Main.java

/**
 * /*from   w ww  .ja v a 2  s . c  o  m*/
 * @return
 */
public static String ID_DayName() {
    Calendar cal = Calendar.getInstance();
    int dayOfWeek = cal.get(Calendar.DAY_OF_WEEK);
    String weekDayName = "";

    if (Calendar.MONDAY == dayOfWeek) {
        weekDayName = "Senin";
    } else if (Calendar.TUESDAY == dayOfWeek) {
        weekDayName = "Selasa";
    } else if (Calendar.WEDNESDAY == dayOfWeek) {
        weekDayName = "Rabu";
    } else if (Calendar.THURSDAY == dayOfWeek) {
        weekDayName = "Kamis";
    } else if (Calendar.FRIDAY == dayOfWeek) {
        weekDayName = "Jumat";
    } else if (Calendar.SATURDAY == dayOfWeek) {
        weekDayName = "Sabtu";
    } else if (Calendar.SUNDAY == dayOfWeek) {
        weekDayName = "Minggu";
    }

    return weekDayName;
}

From source file:Main.java

public static int getDayOfWeek(Date date, int defSunday) {
    Calendar c = Calendar.getInstance();
    c.setTime(date);/*from ww w  .ja  v  a  2s.  com*/
    int day = c.get(Calendar.DAY_OF_WEEK);
    switch (day) {
    case Calendar.MONDAY:
        return 1;
    case Calendar.TUESDAY:
        return 2;
    case Calendar.WEDNESDAY:
        return 3;
    case Calendar.THURSDAY:
        return 4;
    case Calendar.FRIDAY:
        return 5;
    case Calendar.SATURDAY:
        return 6;
    case Calendar.SUNDAY:
        return defSunday;
    default:
        return 0;
    }
}

From source file:Main.java

public static String getDateString() {
    String stringDate = "";
    Calendar calendar = Calendar.getInstance();
    int day = calendar.get(Calendar.DAY_OF_WEEK);
    int month = calendar.get(Calendar.MONTH);
    int dayInt = calendar.get(Calendar.DAY_OF_MONTH);
    switch (day) {
    case Calendar.SUNDAY:
        stringDate += "Sunday";
        break;/* ww w  . j ava 2 s  . c  om*/

    case Calendar.MONDAY:
        stringDate += "Monday";
        break;

    case Calendar.TUESDAY:
        stringDate += "Tuesday";
        break;

    case Calendar.WEDNESDAY:
        stringDate += "Wednesday";
        break;

    case Calendar.THURSDAY:
        stringDate += "Thursday";
        break;

    case Calendar.FRIDAY:
        stringDate += "Friday";
        break;

    case Calendar.SATURDAY:
        stringDate += "Saturday";
        break;

    }
    switch (month) {
    case Calendar.JANUARY:
        stringDate += ", January";
        break;

    case Calendar.FEBRUARY:
        stringDate += ", February";
        break;

    case Calendar.MARCH:
        stringDate += ", March";
        break;

    case Calendar.APRIL:
        stringDate += ", April";
        break;

    case Calendar.MAY:
        stringDate += ", May";
        break;

    case Calendar.JUNE:
        stringDate += ", June";
        break;

    case Calendar.JULY:
        stringDate += ", July";
        break;

    case Calendar.AUGUST:
        stringDate += ", August";
        break;

    case Calendar.SEPTEMBER:
        stringDate += ", September";
        break;

    case Calendar.OCTOBER:
        stringDate += ", October";
        break;

    case Calendar.NOVEMBER:
        stringDate += ", November";
        break;

    case Calendar.DECEMBER:
        stringDate += ", December";
        break;

    }

    stringDate += (" " + dayInt);

    return stringDate;
}

From source file:Main.java

/**
 * Converts the day of the week from android.text.format.Time to java.util.Calendar
 *//*from w  ww . j  a  v  a 2s  .  c o m*/
public static int convertDayOfWeekFromTimeToCalendar(int timeDayOfWeek) {
    switch (timeDayOfWeek) {
    case Time.MONDAY:
        return Calendar.MONDAY;
    case Time.TUESDAY:
        return Calendar.TUESDAY;
    case Time.WEDNESDAY:
        return Calendar.WEDNESDAY;
    case Time.THURSDAY:
        return Calendar.THURSDAY;
    case Time.FRIDAY:
        return Calendar.FRIDAY;
    case Time.SATURDAY:
        return Calendar.SATURDAY;
    case Time.SUNDAY:
        return Calendar.SUNDAY;
    default:
        throw new IllegalArgumentException("Argument must be between Time.SUNDAY and " + "Time.SATURDAY");
    }
}

From source file:com.mirth.connect.donkey.model.channel.PollConnectorPropertiesAdvanced.java

public PollConnectorPropertiesAdvanced() {
    weekly = true;//from   www.  j  a  v  a  2s . c o m
    inactiveDays = new boolean[8];

    inactiveDays[Calendar.SUNDAY] = false; // true means to exclude
    inactiveDays[Calendar.MONDAY] = false;
    inactiveDays[Calendar.TUESDAY] = false;
    inactiveDays[Calendar.WEDNESDAY] = false;
    inactiveDays[Calendar.THURSDAY] = false;
    inactiveDays[Calendar.FRIDAY] = false;
    inactiveDays[Calendar.SATURDAY] = false;

    dayOfMonth = 1;

    allDay = true;

    startingHour = 8;
    startingMinute = endingMinute = 0;
    endingHour = 17;
}