publicstaticlonggetDayCount( String start, String end ){ SimpleDateFormat format = new SimpleDateFormat( "yyyy-M-d" );
long diff = -1;
try { Date dateStart = format.parse( start ); Date dateEnd = format.parse( end );
// time is always 00:00:00 so rounding should help to ignore the // missing hour when going from winter to summer time as well as the // extra hour in the other direction diff = Math.round( ( dateEnd.getTime() - dateStart.getTime() ) / (double)( 60 * 60 * 24 * 1000 ) ); } catch ( Exception e ) { e.printStackTrace(); }