Java Utililty Methods Week Day

List of utility methods to do Week Day

Description

The list of methods to do Week Day are organized into topic(s).

Method

StringgetWeekBeginDay(String date)
get Week Begin Day
Calendar cal = Calendar.getInstance();
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
cal.setTime(df.parse(date));
cal.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
return df.format(cal.getTime());
StringgetWeekDay()
get Week Day
String weekday;
Date date = new Date();
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
int week_index = calendar.get(Calendar.DAY_OF_WEEK) - 1;
switch (week_index) {
case 0: {
    weekday = "sunday";
...
StringGetWeekDay()
Get Week Day
Calendar c = Calendar.getInstance();
int dayOfWeek = c.get(Calendar.DAY_OF_WEEK);
switch (dayOfWeek) {
case 2:
    return "monday";
case 3:
    return "tuesday";
case 4:
...
StringgetWeekDay()
get Week Day
int weekDay = Calendar.getInstance().get(Calendar.DAY_OF_WEEK);
System.out.println(weekDay);
String weekDay1 = String.valueOf(weekDay);
return weekDay1;
intgetWeekday(Date date)
Function: get the date's weekday
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
return calendar.get(Calendar.DAY_OF_WEEK);
StringgetWeekDay(Date date)
get Week Day
return getFormat(week).format(date);
DategetWeekDay(Date dt, int weekDay)
get Week Day
Calendar cal = new GregorianCalendar();
cal.setTime(dt);
if (weekDay == 7) {
    weekDay = 1;
} else {
    weekDay++;
cal.set(GregorianCalendar.DAY_OF_WEEK, weekDay);
...
intgetWeekDay(int weekday)
get Week Day
if (weekday == 1) {
    return Calendar.MONDAY;
} else if (weekday == 2) {
    return Calendar.TUESDAY;
} else if (weekday == 3) {
    return Calendar.WEDNESDAY;
} else if (weekday == 4) {
    return Calendar.THURSDAY;
...
StringgetWeekDay(String date)
get Week Day
return formatDateTime(parse(date), "EE");
StringgetWeekday(String date)
get Weekday
SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat sdw = new SimpleDateFormat("E");
Date d = null;
try {
    d = sd.parse(date);
} catch (ParseException e) {
    e.printStackTrace();
    d = new Date();
...