I want to compare the date part of two java.util.Date objects. How can I achieve this? I am not looking to comparing the date, month and year separately.
Thanks in advance!
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.
A
Dateis just an instant in time. It only really “means” anything in terms of a date when you apply a calendar and time zone to it. As such, you should really be looking atCalendar, if you want to stick within the standard Java API – you can create aCalendarobject with the rightDateand time zone, then set the time components to 0.However, it would be nicer to use Joda Time to start with, and its
LocalDatetype, which more accurately reflects what you’re interested in.