This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi, I've got a simple problem please help me, I have 2 java.util.Date() Objects e.g. date1 = 2003 Jul 01 12:45:36 date2 = 2003 Jul 01 09:08:59 now I'd like to compare the two dates without the Time Part that means: if(date1.compareTo(date2) = 0) should return 0 now the question how to compare only the DatePart of a java.util.Date? Thanks for helping [ July 03, 2003: Message edited by: Dekan ]
Hi Dekan, You can get the year, month, and date with getYear(), getMonth(), and getDate() from both Date object, then compare it. But since it's deprecated, you can use class GregorianCalendar instead. There is the method get(int field). Susilo