Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java Java Data Structures - Retired Getting There Class Review

tomtrnka
tomtrnka
9,780 Points

Is it common to use java.util.date? Or do people prefer different class that handles dates from different library?

java.util.date commonly used in practise? any other libraries that are more widespread in java?

thank you

1 Answer

Brandon Knapp
PLUS
Brandon Knapp
Courses Plus Student 8,161 Points

Java 8 introduced a new date/time library known as LocalDateTime which is much more powerful and feature-rich than java.util.date. It is based off of an extremely popular library which was known as Joda-time, which is still very popular with Java developers who wanted better date/time support. Going forward, I believe that java.util.date is now deprecated, however if you work with legacy software in industry, you're bound to come across a lot of code that still uses java.util.date. There are a small number of pitfalls if you plan on using LocalDateTime. The biggest one that I encountered was that JPA 2 doesn't support LocalDateTime out of the box at this time. You'll need to write your own wrapper-converter. I'm not sure if Hibernate 4 or other third party object-relational mappers do either.