Calendar complete() Method in Java with Examples
The complete() method in Calendar class is used to fill any unset fields of the calendar fields. It follows the following process of completion:
- At first, if the time value has not been calculated, the computeTime() method is called to calculate it from calendar field values.
- Second, to calculate all the calendar field values the computeFields() method is used.
protected void complete()
Parameters: The method does not take any parameters.
Return Value: The method does not return any value.
Below programs illustrate the working of complete() Method of Calendar class:
The Current date is: Wed Feb 13 15:39:33 UTC 2019 The new date is: Tue Jan 01 00:00:00 UTC 2008
The Current date is: Wed Feb 13 15:39:36 UTC 2019 The new date is: Mon Jan 01 00:00:00 UTC 1996
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.