date formating
I'm sure I'm making this overly complicated, but I could use some input.
I'm getting the current date with the following code...
// Get date
SimpleDateFormat sdf = new SimpleDateFormat(CONSTANTS.DATE_FORMAT);
Calendar cal = Calendar.getInstance();
String displayDate = sdf.format(cal.getTime());
When prompted I need to compare displayDate to the current date so that I can say "these dates are X hours apart". My problem is since displayDate is a String, I can't convert it to say millisecs to do the comparison.
Any suggestions?
Thanks
I'm getting the current date with the following code...
// Get date
SimpleDateFormat sdf = new SimpleDateFormat(CONSTANTS.DATE_FORMAT);
Calendar cal = Calendar.getInstance();
String displayDate = sdf.format(cal.getTime());
When prompted I need to compare displayDate to the current date so that I can say "these dates are X hours apart". My problem is since displayDate is a String, I can't convert it to say millisecs to do the comparison.
Any suggestions?
Thanks
