转载出处:https://blog.csdn.net/pengyu1801/article/details/50408444
间隔=Date1.getTime()-Date2.getTime();得出来的是毫秒数.
除1000是秒,再除60是分,再除60是小时.
SimpleDateFormat myFormatter = new SimpleDateFormat( "yyyy-MM-dd ");
java.util.Date date= myFormatter.parse( "2003-06-01 ");
java.util.Date mydate= myFormatter.parse( "2003-05-01 ");
long day=(date.getTime()-mydate.getTime())/(24*60*60*1000);
System.out.println( "相差的日期: " + day);