Revision: 26520
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at April 29, 2010 23:30 by habib123
Initial Code
Calendar calendar1 = Calendar.getInstance(); Calendar calendar2 = Calendar.getInstance(); DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date date = new Date(); try { date = formatter.parse(trailLoginDate); } catch (Exception e) { // TODO: handle exception } calendar1.setTime(date); calendar2.setTime(new Date()); long milliseconds1 = calendar1.getTimeInMillis(); long milliseconds2 = calendar2.getTimeInMillis(); long diff = milliseconds2 - milliseconds1; long diffDays = diff / (24 * 60 * 60 * 1000); days = (int)diffDays;
Initial URL
Initial Description
Initial Title
Date difference
Initial Tags
date
Initial Language
Java