Javatpoint Logo
Javatpoint Logo

Java Date before() Method

The before() method of Java Date class tests whether the date is before the specified date or not.

Syntax:

Parameters

when - a date

Return

It returns a Boolean value. It will return true if this date is before the specified date otherwise false.

Exception

NullPointerException will be thrown if when is null.

Example 1

Test it Now

Output:

Date 'd' is before Date 'd2' : true

Example 2

Test it Now

Output:

Date 'd' is before Date 'd2' : false

Next Topicjava.util.Date





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA