| 注册
请输入搜索内容

热门搜索

Java Linux MySQL PHP JavaScript Hibernate jQuery Nginx
en9
10年前发布

Java计算两个日期相差天数

import java.util.*;     public class Test {      public static void main(String args[]) {          Calendar calendar = Calendar.getInstance();          calendar.setTime(new Date());             calendar.set(1991, 7, 7);          long time_1 = calendar.getTimeInMillis();             calendar.set(2012, 8, 31);          long time_2 = calendar.getTimeInMillis();             long space = (time_2 - time_1) / (1000 * 60 * 60 * 24);          System.out.println("至今我活了大约 " + space + " 天");      }  }