在网上看到了一个C语言计算日期间隔的方法,咋一看很高深,仔细看更高神,很巧妙. 先直接代码吧 #include <stdio.h> #include <stdlib.h> int day_diff(int year_start, int month_start, int day_start , int year_end, int month_end, int day_end) { int y2, m2, d2; int y1, m1, d1; m1 = (month…
java如何计算两个日期之间相差多少天? public static void main(String [] args) { Date now = new Date(); Calendar cal = Calendar.getInstance(); cal.set(2015,2,24);// cal.set(Calendar.YEAR, 2015);// cal.set(Calendar.MONTH, 2);// cal.set(Calendar.DATE, 24); long interval…
#include <stdio.h> #include <stdlib.h> int day_diff(int year_start, int month_start, int day_start , int year_end, int month_end, int day_end) { int y2, m2, d2; int y1, m1, d1; m1 = (month_start + 9) % 12; y1 = year_start - m1/10; d1…
//两个时间相差天数 兼容firefox chrome var days = function(startDate) { var sdate = new Date(startDate.replace(/-/g, "/")); var now = new Date(); var days = now.getTime() - sdate.getTime(); var day = parseInt(days / (1000 * 60 * 60 * 24)); return day; …