Java Date to Day getDay(Date date)

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

Description

get Day

License

LGPL

Declaration

public static int getDay(Date date) 

Method Source Code

//package com.java2s;
/**//  w w w . j  a  v  a  2  s .c  o  m
 * Converts a line of text into an array of lower case words using a
 * BreakIterator.wordInstance(). <p>
 *
 * This method is under the Jive Open Source Software License and was
 * written by Mark Imbriaco.
 *
 * @param text a String of text to convert into an array of words
 * @return text broken up into an array of words.
 */

import java.util.Calendar;

import java.util.Date;

public class Main {
    public static int getDay(long t) {
        Calendar cld = Calendar.getInstance();
        if (t > 0) {
            cld.setTime(new java.util.Date(t));
        }
        return cld.get(Calendar.DAY_OF_MONTH);
    }

    public static int getDay(Date date) {
        Calendar cld = Calendar.getInstance();
        cld.setTime(date);
        return cld.get(Calendar.DAY_OF_MONTH);
    }

    public static int getDay() {
        Calendar cld = Calendar.getInstance();
        cld.setTime(new java.util.Date());
        return cld.get(Calendar.DAY_OF_MONTH);
    }
}

Related

  1. getDay(Date date)
  2. getDay(Date date)
  3. getDay(Date date)
  4. getDay(Date date)
  5. getDay(Date date)
  6. getDay(Date date)
  7. getDay(Date date)
  8. getDay(Date date)
  9. getDay(Date date, int day)