Android Today Get isToday(long time)

Here you can find the source of isToday(long time)

Description

is Today

License

Apache License

Declaration

public static boolean isToday(long time) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.Calendar;

import java.util.GregorianCalendar;

public class Main {
    public static boolean isToday(long time) {
        GregorianCalendar calendar = (GregorianCalendar) Calendar
                .getInstance();/*from  w ww. j a  v a 2s .  c o  m*/
        calendar.setTimeInMillis(System.currentTimeMillis());
        int systemDay = calendar.get(Calendar.DAY_OF_MONTH);
        int systemMonth = calendar.get(Calendar.MONTH);
        int systemYear = calendar.get(Calendar.YEAR);

        calendar.setTimeInMillis(time);
        int day = calendar.get(Calendar.DAY_OF_MONTH);
        int month = calendar.get(Calendar.MONTH);
        int year = calendar.get(Calendar.YEAR);

        return systemDay == day && systemMonth == month
                && systemYear == year;
    }
}

Related

  1. getLastyearToday(String str)
  2. getTodayFull()
  3. isToday(Calendar today, Calendar date)
  4. isToday(Calendar date)
  5. getNbDaysToDate(Calendar from, int toYear, int toMonth, int toDay)
  6. today()
  7. today()
  8. isToday(long lTime)
  9. getToday()