[java]比较两个日期之间的天数<script
src="http://blog.csdn.net/count.aspx?ID=438390&Type=Rank"></script>
1.import java.text.SimpleDateFormat;
2.import java.util.Date;
1.public class Tmp {
1.public static void main( String argv[] ) throws Exception {
1.long DAY = 24L * 60L * 60L * 1000L;
1.SimpleDateFormat df = new SimpleDateFormat( "MM.dd.yyyy" );
2.Date d1 = df.parse( "01.01.2001" );
3.Date d2 = df.parse( "01.03.2001" );
4.System.out.println( "The number days between:" );
5.System.out.println( d1 );
6.System.out.println( "and:" );
7.System.out.println( d2 );
8.System.out.println( "is: " + (( d2.getTime() - d1.getTime() ) / DAY ));
9.}
10.}