get Current Week Day - Android java.util

Android examples for java.util:Week

Description

get Current Week Day

Demo Code


//package com.java2s;
import java.util.Calendar;

public class Main {
    public static String getCurrentWeekDay() {
        Calendar calendar = Calendar.getInstance();
        int day = calendar.get(Calendar.DAY_OF_WEEK);

        switch (day) {
        case Calendar.SUNDAY:
            return "Sunday";
        case Calendar.MONDAY:
            return "Monday";
        case Calendar.TUESDAY:
            return "Tuesday";
        case Calendar.WEDNESDAY:
            return "Wednesday";
        case Calendar.THURSDAY:
            return "Thursday";
        case Calendar.FRIDAY:
            return "Friday";
        case Calendar.SATURDAY:
            return "Saturday";
        default://from   ww  w  .ja v a 2 s.  c om
            return null;
        }
    }
}

Related Tutorials