Java Day getDayofTheDate(Date d1)

Here you can find the source of getDayofTheDate(Date d1)

Description

To Find the day of the week

License

Open Source License

Parameter

Parameter Description
d1 the date in question

Return

the day in number depending startin from 1 as Sunday

Declaration

public static String getDayofTheDate(Date d1) 

Method Source Code


//package com.java2s;

import java.text.DateFormat;

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    /**/*w  ww  . j  av  a2 s .c o m*/
     * To Find the day of the week 
     * @param d1 the date in question
     * @return the day in number depending startin from 1 as Sunday
     */
    public static String getDayofTheDate(Date d1) {

        String day = null;
        DateFormat f = new SimpleDateFormat("EEE");
        try {
            day = f.format(d1);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return day;
    }
}

Related

  1. getDayNameForDate(java.util.Date dt, boolean fullname)
  2. getDayNames(Locale locale)
  3. getDayNumber()
  4. getDayOfDate(Date date)
  5. getDayOffset(String date, int offset, String format)
  6. getDAYOFWEEK(String strDate)
  7. getDayRange(String bday, String eday)
  8. getDays(Date day, int preDays, String format)
  9. getDays(Date sd, Date ed)