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

DategetIndexDay(Date origin, int index)
get Index Day
Date dt = origin;
Calendar rightNow = Calendar.getInstance();
rightNow.setTime(dt);
rightNow.add(Calendar.DAY_OF_YEAR, index);
Date dt1 = rightNow.getTime();
return dt1;
DategetDateOfLastSunday(Date d)
get Date Of Last Sunday
Calendar c = Calendar.getInstance();
c.setTime(d);
int weekday = c.get(Calendar.DAY_OF_WEEK);
if (weekday != Calendar.SUNDAY) {
    int days = (Calendar.SUNDAY - weekday) % 7;
    c.add(Calendar.DAY_OF_YEAR, days);
c.set(Calendar.HOUR, 0);
...
DategetStartNextDay(Date d2)
get Start Next Day
Date d = getNextDay(d2);
String dStr = dateToString(d, null);
return stringToDate(dStr, null);
DategetNextDay(Date d2)
get Next Day
if (d2 == null)
    d2 = new Date();
Calendar c1 = Calendar.getInstance();
c1.setTimeInMillis(d2.getTime() + 24 * 60 * 60 * 1000);
return c1.getTime();
DategetNextDateForDay(int calendarDay)
get Next Date For Day
Date date = null;
Calendar cal = Calendar.getInstance();
while (date == null) {
    cal.add(Calendar.DATE, 1);
    if (cal.get(Calendar.DAY_OF_WEEK) == calendarDay) {
        date = cal.getTime();
return date;
intgetHashByDay(String date)
get Hash By Day
Date mDate = null;
int dateInt = 0;
Calendar cal = Calendar.getInstance();
if (date != null && !date.isEmpty()) {
    try {
        mDate = DateTimeUtil.stringToDate(date);
    } catch (ParseException e) {
        Log.e(TAG, "Unparsable date");
...
intgetJulianDay(Calendar cal)
get Julian Day
Time time = new Time();
time.set(cal.getTimeInMillis());
return Time.getJulianDay(cal.getTimeInMillis(), time.gmtoff);
longgetIntervalDays(String sd, String ed)
get Interval Days
return ((java.sql.Date.valueOf(ed)).getTime() - (java.sql.Date
        .valueOf(sd)).getTime()) / (3600 * 24 * 1000);
booleanisBirthday(Calendar cal)
is Birthday
Calendar sysdate = Calendar.getInstance();
return ((cal != null)
        && (sysdate.get(Calendar.DAY_OF_MONTH) == cal
                .get(Calendar.DAY_OF_MONTH)) && (sysdate
            .get(Calendar.MONTH) == cal.get(Calendar.MONTH)));
StringgetBeforeDate(Date date, int days)
get Before 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());