Java Calendar getTime() Method

The getTime() method of java.util.Calendar class is a final method. This method gets the time value of calendar object and returns the date.

Syntax

Parameter

No parameter is passed.

Returns

Returns a date which represents time value of calendar object.

Throws

Does not throw exception.

Example 1

Output:

Date :Sat Nov 23 00:00:00 PST 1996
 new Date is :Mon Jan 25 00:00:00 PST 1999

Example 2

Output:

Date :Wed Aug 08 21:33:33 PDT 2018
 new Date is :Mon Oct 07 21:33:33 PDT 1996