I just want to extract the time component of the calendar object for comparison to another. Is this possible?
here's my code:
thanks!
kind regards.
JR
here's my code:
Code:
try { String str_date="2009-10-15 12:1:00"; DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd k:mm:ss"); Date date = (Date)formatter.parse(str_date); Calendar cal = Calendar.getInstance(); cal.setTime(date); System.out.println("Today is " +date ); //need to do something here to get just the time field //for comparing. Just the hours, minutes and seconds. //I want to do something like //if (cal.getTime() > someTimeObject ) // do something here } catch (java.text.ParseException e) { e.printStackTrace(); }
kind regards.
JR
Comment