Java Calendar clear() MethodThe java.util.Calendar.clear() method sets the given calendar field value and the time value of this Calendar undefined. A Calendar implementation class may use default field values for date and time calculations. SyntaxParameterField - calendar field to set as undefined. ReturnsThis method does not return any value. ThrowsNA Example 1Test it NowOutput: Current Calendar Date: Mon Jul 30 06:35:54 PDT 2018 The calendar shows : Thu Jul 30 06:35:54 PDT 1970 Example 2Test it NowOutput: Current Calendar Date: Mon Jul 30 06:39:17 PDT 2018 The calendar shows : Tue Jan 30 06:39:17 PST 2018 Example 3Test it NowOutput: Current Calendar Date: Mon Jul 30 06:45:15 PDT 2018 The calendar shows : Mon Jul 30 06:45:15 PDT 2018 The calendar shows : Mon Jul 30 06:00:00 PDT 2018 Example 4Test it NowOutput: Current Calendar Date: Mon Jul 30 06:48:47 PDT 2018 The calendar shows : Mon Jul 30 06:00:00 PDT 2018
Next TopicJava Calendar Class
|