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 :: check instance of java 
Java :: Java tree from star 
Java :: java check two dates same day 
Java :: convert bytebuffer to string 
Java :: inputstream to string java 
Java :: clear jtable rows java 
Java :: how to add animation between activity in android 
Java :: public String toString() { 
Java :: how to use scanners in java 
Java :: check whether a double is not a number in java 
Java :: java selenium implicitly wait 
Java :: how to acces every char of a String in java 
Java :: java string to lower case 
Java :: set password visible in android 
Java :: android studio proportional width 
Java :: in java how to throw exception from function 
Java :: Create a button that redirects to another activity in android studio 
Java :: android list index 
Java :: how to convert string array to int in java 
Java :: max of an array java 
Java :: android zoom animation 
Java :: split method in java 
Java :: check if sqlexception is duplicate entry java 
Java :: graph contains a cycle 
Java :: queue implementation in java using arraylist 
Java :: get year month day from date string java 
Java :: array.sort in java 
Java :: viewpager androidx dependencies 
Java :: write an infinite loop java 
Java :: how to get current date in java 
ADD CONTENT
Topic
Content
Source link
Name
7+5 =