Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

compare date with current date in android

SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
Date strDate = sdf.parse(my_date);
if (new Date().after(strDate)) {
    your_date_is_outdated = true;
}
else{
    your_date_is_outdated = false;
}
Comment

how to compare current date and time with another date and time in android

Date date1 = calendar1.getTime();
Date date2 = calendar2.getTime();
if (date1.compareTo(date2) > 0)
{    Log.i("app", "Date1 is after Date2");} 
else if (date1.compareTo(date2) < 0) 
{    Log.i("app", "Date1 is before Date2");} 
else if (date1.compareTo(date2) == 0) 
{    Log.i("app", "Date1 is equal to Date2");}
Comment

PREVIOUS NEXT
Code Example
Java :: java instant to localdatetime 
Java :: decomposer chaine de caractère java 
Java :: int to binary java 
Java :: javafx every second 
Java :: hashmap.foreach example 
Java :: string to long java 
Java :: Java @Inherited 
Java :: greatest common divisor java 
Java :: spigot despawn entity 
Java :: How to convert timestamp to time in java 
Java :: convert string to byte java 
Java :: what is final in java 
Java :: why to use serializable with java bean 
Java :: java biginteger multiply 
Java :: Triangle Pattern In Java 
Java :: print to console in java 
Java :: random number between 1 and 100 java 
Java :: fibonacci in java 
Java :: how to truncate decimals in java 
Java :: convert java to kotlin online editor 
Java :: what is the use of println 
Java :: nginx change root directory 
Java :: how to make an int into a string java 
Java :: sort list of strings java 
Java :: get current unix timestamp java 
Java :: how to format numbers in java 
Java :: cosinus-1 java 
Java :: bigdecimal to string 
Java :: java argument main 
Java :: random java 
ADD CONTENT
Topic
Content
Source link
Name
6+7 =