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 trialDaiane Silva
5,668 PointsWhy use the Date Class if is deprecated??
Why should we learn the Class Date if is deprecated, wouldn't be better to use the Class Calendar?
1 Answer
Alan Michels
15,645 PointsIf you look carefully at the second to last constructor that Craig is showing in the documentation you will see that it is NOT deprecated. It uses Date(long Date). He first uses the epoch converter to get the date in milliseconds. Then he passes it in as new Date(1421849732000). The integer number was too long so he had to use a "long " integer. The long integer was 1421849732000L. For most computers an integer is 32 binary digits and 64 binary digits for long integers. Really 31 and 63 so you can have positive and negative numbers.