Javatpoint Logo
Javatpoint Logo

Java Calendar after() Method

This method returns true if the time represented by this Calendar is after the time represented by when Object. If it is not the case, false is returned.

Syntax

Parameter

When - the Object of time that is about to be compared.

Returns

True if the time represented by this Calendar is after the time represented by when Object; false otherwise.

Example 1

Test it Now

Output:

Current date: Sun Jul 29 07:50:47 PDT 2018
Year is 2015
Date Wed Jul 29 07:50:47 PDT 2015 is before current date.

Example 2

Test it Now

Output:

Current date: Sun Jul 29 07:52:17 PDT 2018
Year is 10
Date Thu Nov 29 07:52:17 PST 2018 is after current date.

Example 3

Test it Now

Output:

Current date: Sun Jul 29 07:53:23 PDT 2018
Year is 30
Date Mon Jul 30 07:53:23 PDT 2018 is after current date.

Example 4

Test it Now

Output:

Output
Current date: Sun Jul 29 07:54:14 PDT 2018
Now date is  Mon Jul 30 06:54:14 PDT 2018
Now date is  Mon Jul 30 07:00:14 PDT 2018
Now date is  Mon Jul 30 07:00:30 PDT 2018
Date Mon Jul 30 07:00:30 PDT 2018 is after current date.



Please Share

facebook twitter google plus pinterest