Is a date before another date
import java.util.Date;
public class Main {
public static void main(String[] args) {
Date d1 = new Date();
Date d2 = new Date();
System.out.println("First Date : " + d1);
System.out.println("Second Date : " + d2);
System.out.println("Is first date before second ? : " + d1.before(d2));
}
}
Home
Java Book
Runnable examples
Java Book
Runnable examples
Date Compare:
- Are two calendar objects represent the same local time.
- Are two dates or two calendars the same day
- Is a date the same day with another date
- Is a date after another date
- Is a date before another date
- Is date or calendar today's date
- Is a calendar or date after/before today or within a number of days in the future
- Compare two Date objects using compareTo
- Compares two dates are equals at day, month and year level, ignoring time
- Compare two times equals regardless of the date
- Compare two dates and times for equal
- Compare two Date