O'Reilly logo

Java™ Phrasebook by Timothy Fisher

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

5. Dates and Times

Most Java programs have to deal with dates and times at one point or another. Fortunately, Java has good built-in support for working with dates and times. Three primary classes are used in most Java programs to store and manipulate times and dates. Those classes are the java.util.Date class, the java.sql.Date class, and the java.util.Calendar class.

Many of the methods in the java.util.Date class have become deprecated, meaning that you should avoid using them in new development. The deprecated methods generally deal with the creation and manipulation of dates. For these operations, the java.util.Calendar class is the preferred mechanism to use. It is also easy to convert between Date and Calendar objects, so if you prefer ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required