That should work.
Put it in its own method if you want it to be cleaner.
Those methods are marked as deprecated in
Java 5.0 - not sure what th suggested new way should be. I think it involves Calendar.
(aside: English note - "I want to compare two dates neglecting their timestamps", I'm not trying to be rude, there's a lot of English as a second language on The Ranch, and a lot of "what should I learn for a job interview", and better written and oral communications are at least as high as programming skills!, and their/there/they're is a common English problem, and a nitpick of many people (including me
)