getTime(): The getTime() method returns a date/time of the calendar in a Date object. Date objects are stored as an offset in milliseconds. The general form of the getTime() method is as follows:
Date getTime()
e.g. System.out.println(calendar.getTime());
setTime(): The setTime() method sets the current calendar’s date/time from the value of the specified date. The general form of the setTime() method is as follows:
void setTime(Date date)
e.g. calendar.setTime(date2);
Responses to “What are the getTime() and setTime() method?”