What can I use to replace this, new Date(2009, 12, 9)?
Thanks for your help.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Note: this answer was written in 2009. Since then,
java.timehas become the preferred date/time API in Java.Ideally, use Joda Time instead. It’s an infinitely superior API to the built-in one. You’d then want to choose between
LocalDateTimeandDateTimedepending on your exact requirements (it’s a complicated area – I’m not going to try to summarise in a sentence or two, but the docs do a good job).If absolutely necessary, use a java.util.Calendar and convert that to a
Datewhen you need to.