What is the Calendar class?

Are you preparing for IT certification? With practice questions, study notes, interactive quizzes, tips and technical articles, uCertify PrepKits ensure that you get a solid grasp of core technical concepts to ace your certification exam in first attempt.

What is the Calendar class?

Rating:

The Calendar class is abstract and provides methods to convert the time in milliseconds to the calendar fields such as seconds, minutes, hours, days, weeks, months, and years. It makes the manipulation of dates easy.

The Calendar class does not provide any public constructor. It is instantiated using the Calendar.getInstance() method as follows:

Calendar c = Calendar.getInstance();

The important methods of the Calendar class are as follows:

  • c.add(f1, val): This method adds the value val to the field f1. The field f1 can be a year, a month, a week, an hour, etc.

  • c.roll(f1, val): This method is similar to the add method, with the exception that when a part of the date is changed as a result of addition, its larger part does not change. This means that adding even more than twenty-four hours to the hour field will not change the day field.


Rating:



Other articles

Click here to Article home

 
uCertify.com | Our Company | Articles | Privacy | Security | Contact Us | News and Press Release | uCertify India
MCSE: MCSA, MCTS, MCITP    JAVA Certification: SCJP, SCWCD Cisco Certification: CCNA, CCENT, A+, Network+, Security+
Oracle Certification: OCP 9i, OCP 10g, OCA 9i, OCA 10g CIW foundation    EC-212-32    CISSP    Photoshop ACE    Adobe Flash ACE
© 2008 uCertify.com. All rights reserved. All trademarks are the property of their respective owners.