Java Calendar setTime() MethodThe setTime () method of java.util.Calendar class is used to set the Time of current calendar object. A Date object id is passed as the parameter into this method. SyntaxParameterdate - a date object. ReturnsDoes not return value. ThrowsDoes not throw Exception. Example 1Test it NowOutput: Date :Sat Nov 23 00:00:00 PST 1996 new Date is :Sun Nov 10 00:00:00 PST 1918 Example 2Test it NowOutput: Date (mycal):Wed Aug 15 19:07:31 PDT 2018 Date (mycal2) :Mon Oct 14 19:07:31 PDT 1996
Next TopicJava Calendar Class
|