Java Week Day getWeekdayOfDateTime(String datetime)

Here you can find the source of getWeekdayOfDateTime(String datetime)

Description

get Weekday Of Date Time

License

Open Source License

Declaration

public static int getWeekdayOfDateTime(String datetime) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.text.DateFormat;

import java.text.SimpleDateFormat;

import java.util.Calendar;

public class Main {

    public static int getWeekdayOfDateTime(String datetime) {
        DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
        Calendar c = Calendar.getInstance();
        try {/*  w w  w . jav  a2 s  . c om*/
            c.setTime(df.parse(datetime));
        } catch (Exception e) {
            e.printStackTrace();
        }
        int weekday = c.get(Calendar.DAY_OF_WEEK) - 1;
        return weekday;
    }
}

Related

  1. getWeekdayForInt(int value)
  2. getWeekdayName(Date date)
  3. getWeekdayNames()
  4. getWeekdayNames(Locale locale)
  5. getWeekDayNUM()
  6. getWeekdays(DateFormatSymbols symbols)
  7. getWeekDayStr(int dayInWeek)
  8. getWeekendDays(Locale locale)
  9. getWeekFirstDay(Date date)