Android Utililty Methods Date Get

List of utility methods to do Date Get

Description

The list of methods to do Date Get are organized into topic(s).

Method

intgetDayOfWeek(String year, String month, String day)
get Day Of Week
Calendar cal = new GregorianCalendar(Integer.valueOf(year)
        .intValue(), Integer.valueOf(month).intValue() - 1, Integer
        .valueOf(day).intValue());
return cal.get(Calendar.DAY_OF_WEEK);
intgetDayofWeekInMonth(String year, String month, String weekOfMonth, String dayOfWeek)
get Dayof Week In Month
Calendar cal = new GregorianCalendar();
int y = Integer.valueOf(year).intValue();
int m = Integer.valueOf(month).intValue();
cal.clear();
cal.set(y, m - 1, 1);
cal.set(Calendar.DAY_OF_WEEK_IN_MONTH, Integer.valueOf(weekOfMonth)
        .intValue());
cal.set(Calendar.DAY_OF_WEEK, Integer.valueOf(dayOfWeek).intValue());
...
intgetDaysOfCurMonth()
get Days Of Cur Month
int curyear = Integer.valueOf(getCurrentYear()).intValue();
int curMonth = Integer.valueOf(getCurrentMonth()).intValue();
int mArray[] = new int[] { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31,
        30, 31 };
if ((curyear % 400 == 0)
        || ((curyear % 100 != 0) && (curyear % 4 == 0))) {
    mArray[1] = 29;
return mArray[curMonth - 1];
intgetDaysOfCurMonth(final String time)
get Days Of Cur Month
if (time.length() != 7) {
    throw new NullPointerException("yyyy-MM");
String[] timeArray = time.split("-");
int curyear = Integer.valueOf(timeArray[0]).intValue();
int curMonth = Integer.valueOf(timeArray[1]).intValue();
if (curMonth > 12) {
    throw new NullPointerException("null pointer ");
...
intgetMonth(Date date)
get Month
if (null == date) {
    throw new IllegalArgumentException("The date is null");
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
return calendar.get(Calendar.MONTH);
longgetTomorrowAtEight()
get Tomorrow At Eight
Calendar calendar = Calendar.getInstance();
stripTime(calendar);
calendar.set(Calendar.HOUR_OF_DAY, 8);
calendar.add(Calendar.DAY_OF_MONTH, 1);
return calendar.getTime().getTime();
intgetWeekOfDate(Date dt)
get Week Of Date
Calendar cal = Calendar.getInstance();
cal.setTime(dt);
int w = cal.get(Calendar.DAY_OF_WEEK);
return w;
intgetYear(Date date)
get Year
Calendar calendar = new GregorianCalendar();
calendar.setTime(date);
return calendar.get(Calendar.YEAR);
DategetDateObj()
get Date Obj
Calendar c = new GregorianCalendar();
return c.getTime();
DategetDate(int year, int month, int date, int hourOfDay, int minute, int second)
get Date
Calendar cal = new GregorianCalendar();
cal.set(year, month, date, hourOfDay, minute, second);
return cal.getTime();