例如,如果我输入的是:@H_502_3@
2(周),2012@H_502_3@
然后我的输出应该是:@H_502_3@
2012-01-08和2012-01-14@H_502_3@
var year = 2012; var week = 2; var d = new Date("Jan 01," + year + " 01:00:00"); var w = d.getTime() + 604800000 * (week - 1); var n1 = new Date(w); var n2 = new Date(w + 518400000) console.log(n1); console.log(n2);
n1包含一周的第一天n2包含一周的最后一天@H_502_3@
至于常数:604800000是一周,以毫秒为单位518400000是六天@H_502_3@