#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
<script type="text/javascript"> getMonthBetween("2015-05-01","2016-05-01") function getMonthBetween(start,end){ var d1 = new Date(start); var d2 = new Date(end); var month1 = d1.getMonth() + 1,month2 = d2.getMonth() + 1
方法1 /** * 获取某年月的天数 * @param year 年 * @param month 月(0-11) * @returns {number} 天数 */ var getDaysOfMonth = function (year, month) { month = month + 1; switch (month) { case 1: case 3: case 5: case 7: case 8: case 10: case 12: return 31; case 4: case 6:
/** * 优惠券有效期 * startDate:起始日期 * valueTime:有效天数 */ function transferCouponValueTime(startDate,valueTime){ var date = new Date(startDate); var newDate = new Date(date.getFullYear(),date.getMonth(),date.getDate()+valueTime); var year1 = date.getFullYear
月份0---11 var date = new Date(year,fenye_arr[0]-1,fenye_arr[1]); miao=date.getTime(); var _year=new Date(miao-j*24*3600*1000).getFullYear(); var _yue=new Date(miao-j*24*3600*1000).getMonth()+1; var _ri=new Date
在网上看到了一个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