我有两个下拉列表 - 一个是一年,一个是几周.如何确定所选的周日期应该是星期五.例如,我选择了第34周和2011年,那么我应该知道星期五的日期,格式如下:2011-08-23.最好也是在javascript中.
使用date.js.任何与日期相关的Javascripting都非常方便.
他们网站的例子:
// What date is next thrusday?
Date.today().next().thursday();
// Add 3 days to Today
Date.today().add(3).days();
// Is today Friday?
Date.today().is().friday();
// Number fun
(3).days().ago();
// 6 months from now
var n = 6;
n.months().fromNow();
// Set to 8:30 AM on the 15th day of the month
Date.today().set({ day: 15, hour: 8, minute: 30 });
// Convert text into Date
Date.parse('today');
Date.parse('t + 5 d'); // today + 5 days
Date.parse('next thursday');
Date.parse('February 20th 1973');
Date.parse('Thu, 1 July 2004 22:30:00');
Run Code Online (Sandbox Code Playgroud)