I apologize if this is like a dumb question, especially for all of you super-professional programmers out there. I am just beginning to program in Java, and I am starting to do basic things like scheduling procedures which requires comparing the current time to specific times that I have selected to execute certain procedures.
Basically I need a way to get and manipulate date-time objects. The first thing that comes up in may searches (and many answers on SO) is the java.util.Date
object. It seems like this is perfect and has all the basic functions that I need. I like that I can get the current date-time with simple new Date()
. Then when creating other date-time objects, I can use the .getYear()
, .getDate()
, and other methods. The .before()
and .after()
functions are also very useful for what I am trying to do.
Anyway, my question is: why has most of this package been deprecated? This is part of the core java.util package. It is something very important to many programs. I have found newer alternatives like GregorianCalendar
and Joda.time
, not knowing which one will be better for me in the long run. It seems like it would be nice to just use the core java.util.date
and move on. I get the deprecated warnings in my IDE which makes me think maybe this isn't the best thing to do.
I am just trying to understand why this package is not supported anymore, as a humble programmer looking for answers.
Thanks!