Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Java Programming for Beginners

You're reading from   Java Programming for Beginners Learn the fundamentals of programming with Java

Arrow left icon
Product type Paperback
Published in Oct 2017
Publisher Packt
ISBN-13 9781788296298
Length 318 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
SkillSprints Inc., Mark Lassoff SkillSprints Inc., Mark Lassoff
Author Profile Icon SkillSprints Inc., Mark Lassoff
SkillSprints Inc., Mark Lassoff
Arrow right icon
View More author details
Toc

The Calendar class

In this section, we're going to take a look at Java's Calendar class. When writing Java code, we generally use the Calendar class to refer to a specific moment in time.

The Calendar class is actually a relatively new addition to the Java API. Previously, we used a class called Date to perform the similar functionality. If you end up working on older Java code or are writing Java code that deals with a SQL or MySQL database, you'll probably end up using the Java Date class at least occasionally. If this happens, don't panic; consult the Java documentation and you'll discover that there are some really great functions for swapping between Calendar and Date objects.

To see the power of Java's Calendar class, let's jump into a Java program and instantiate it. Let's create a new program; first, import all the classes from the...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime