Java Date to Day getDayOfDate(Date date)

Here you can find the source of getDayOfDate(Date date)

Description

Description:Get Monday of the week the day specified by parameter belongs to

License

Open Source License

Parameter

Parameter Description
Date date any date

Return

boolean

Declaration

public static int getDayOfDate(Date date) 

Method Source Code

//package com.java2s;
/*/*from w w  w .ja  v  a  2s.  c  o m*/
 * $RCSfile: DatetimeUtil,v $$
 * $Revision: 1.0  $
 * $Date: 2011  $
 *
 * Copyright (C) 2011 GyTech, Inc. All rights reserved.
 *
 * This software is the proprietary information of GyTech, Inc.
 * Use is subject to license terms.
 */

import java.util.Calendar;
import java.util.Date;

public class Main {
    /**
     *<p>Description:Get Monday of the week the day specified by parameter belongs to</p>
     * @param Date date any date
     * @return boolean
     */
    public static int getDayOfDate(Date date) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);

        return calendar.get(Calendar.DAY_OF_WEEK) - Calendar.SUNDAY;
    }
}

Related

  1. getDayEnd(Date obj)
  2. getDayEnd(final Date date, TimeZone timezone)
  3. getDayFromDate(Date date)
  4. getDayMonthYear(Date aDate, boolean isAddSpace)
  5. getDayNumber(Date startDate, Date endDate)
  6. getDayOfThisYear(Date currentdate)
  7. getDayOfYear(Date date)
  8. getDays(Date t, Date baseDate)
  9. getDaysEarlierDate(int days)