Android Utililty Methods Day Get

List of utility methods to do Day Get

Description

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

Method

StringgetAfterDate(Date date, int days)
get After Date
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.set(Calendar.DAY_OF_YEAR,
        calendar.get(Calendar.DAY_OF_YEAR) + days);
return df.format(calendar.getTime());
longfromJulianDay(double julianDay)
Creates a date-time from a Julian Day.
double epochDay = julianDay - 2440587.5d;
return (long) (epochDay * 86400000d);
longgetTimeNextDay(long lTimeMillis)
get Time Next Day
Date date = new Date(lTimeMillis);
Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.add(Calendar.DAY_OF_YEAR, 1);
Date dateNext = cal.getTime();
return dateNext.getTime();
intgetDaysTo(Date date)
get Days To
return (int) ((date.getTime() - getCurrentEpochTime()) / ONE_DAY_IN_MILLIS);
StringintDayToString(int day)
int Day To String
return daysOfWeek[day];
intleapDays(int y)
leap Days
if (leapMonth(y) != 0) {
    if ((lunarInfo[y - 1900] & 0x10000) != 0)
        return 30;
    else
        return 29;
} else
    return 0;
intgetDay()
get Day
return Calendar.getInstance().get(Calendar.DAY_OF_MONTH);
StringdayIndexToDate(int dayindex)
day Index To Date
int year = 2013;
int month = 7;
int day = 6;
Calendar cal = Calendar.getInstance();
cal.set(year, month - 1, day);
cal.add(Calendar.DAY_OF_MONTH, dayindex - 1);
return new SimpleDateFormat("EEEEEEEE dd").format(cal.getTime());