Android Long to Date Convert isTomorrow(long lTime)

Here you can find the source of isTomorrow(long lTime)

Description

is Tomorrow

Declaration

public static boolean isTomorrow(long lTime) 

Method Source Code

//package com.java2s;
import java.util.Calendar;
import java.util.Date;

public class Main {
    public static boolean isTomorrow(long lTime) {
        return isDateDayEqual(lTime, getTimeNextDay(lTime));
    }/*from w  ww. j  av  a  2  s  .c o m*/

    public static boolean isDateDayEqual(long lTime1, long lTime2) {
        Calendar cal1 = Calendar.getInstance();
        cal1.setTimeInMillis(lTime1);
        Calendar cal2 = Calendar.getInstance();
        cal2.setTimeInMillis(lTime2);

        return cal1.get(Calendar.YEAR) == cal2.get(Calendar.YEAR)
                && cal1.get(Calendar.DAY_OF_YEAR) == cal2
                        .get(Calendar.DAY_OF_YEAR);
    }

    public static long getTimeNextDay(long lTimeMillis) {
        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();
    }
}

Related

  1. getDateByInt(long va)
  2. getDateTimeString(long dateTime)
  3. getLabelForEventInTime(long inTime)
  4. getTimeDelta(long delta, String dateFormat)
  5. timeAgo(long aTime)
  6. getActivityTime(long startTime, long endTime)
  7. getDate(long timeStamp)
  8. getDateFrom(long timestamp, Context context)
  9. getDateFromLong(long dateLong)