O'Reilly logo

Java Programming for Beginners by Mark Lassoff

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

How Calendar works

If you're like me though, you'd like to know a little bit about how this Calendar object is really operating. Is it storing the month, day, and seconds of time in separate fields, or is there one big number that contains all of this information?

If we spend some time and take a look at the methods available to us in the Calendar class implementation, we'll find these two methods: setTimeInMillis() and its sister method getTimeInMillis() as shown in the following screenshot:

The fact that these methods are specially set aside is a really great window of opportunity for us to see how the Calendar class really thinks.

Let's ...

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