Java Week Day getDayOfWeek(String dat)

Here you can find the source of getDayOfWeek(String dat)

Description

get Day Of Week

License

Open Source License

Declaration

public static String getDayOfWeek(String dat) 

Method Source Code


//package com.java2s;

import java.util.Calendar;

public class Main {

    public static String getDayOfWeek(String dat) {
        dat = dat.replaceAll("-", "");

        int yy = Integer.valueOf(dat.substring(0, 4)).intValue();
        int mm = Integer.valueOf(dat.substring(4, 6)).intValue();
        int dd = Integer.valueOf(dat.substring(6)).intValue();

        String[] dayOfWeek = { "sun", "mon", "tue", "wed", "thu", "fri", "sat" };
        Calendar c = Calendar.getInstance();
        c.set(yy, mm - 1, dd);//  w w  w . jav a2s .  c o  m
        return dayOfWeek[c.get(Calendar.DAY_OF_WEEK) - 1];

    }
}

Related

  1. getDayOfWeek(int _year, int _month, int _day)
  2. getDayOfWeek(int year, int month, int day)
  3. getDayOfWeek(long date)
  4. getDayOfWeek(long date)
  5. GetDayOfWeek(long p)
  6. getDayOfWeek(String date)
  7. getDayOfWeek(String year, String month, String day)
  8. getDayOfWeekAbbreviation(int day)
  9. getDayOfWeekAbreviated(Date d)