Java Day From getDay(Date date)

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

Description

get Day

License

Apache License

Declaration

public static int getDay(Date date) 

Method Source Code

//package com.java2s;
/**//from w  w w  . ja v a 2s. c  o  m
  *  Copyright (c) 2014 http://www.lushapp.wang
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
  */

import java.util.*;

public class Main {
    public static int getDay(Date date) {
        return getDatePar(Calendar.DAY_OF_MONTH, date);
    }

    public static int getDatePar(int par, Date date) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        int result = calendar.get(par);
        switch (par) {
        case Calendar.MONTH:
            result++;
        }
        return result;
    }
}

Related

  1. getDateByDay(Date date)
  2. getDateByNum(int day)
  3. getDateFromDayNum(int dayNum)
  4. getDateUpDay(Date d)
  5. getDay(Date date)
  6. getDay(Date date, int day)
  7. getDay(String date)
  8. getDay0(Date date)
  9. getDayOfDate(Date date)