这会有帮助吗?请注意自动换行。 选项明确 ''* ''*声明常数 ''* Const cVBS =" penuweek.vbs" Const cYER = 2004 ''* ''*声明变量 ''* Dim arrDAT(12,1) Dim intDAT Dim strDAT Dim intDOW Dim intMON Dim stryER strYER = cYER ''* ''* 12个月 ''* 对于intMON = 1到12 ''* ''*下个月的第一天 ''* strDAT = DateSerial(strYER,intMON + 1, 1) ''* ''*本月最后一天 ''* strDAT = DateAdd(" d", - 1,strDAT) ''* ''*星期几 ''* intDOW = DatePart(" w",strDAT,2) ''* ''*星期一之前的日期st $ / $ ''* 如果intDOW = 1则intDOW = 8 intDAT =(intDOW + 6)* -1 strDAT = DateAdd(" d",intDAT,strDAT) arrDAT(intMON,0)= strDAT ''* ''*周日两周后的日期 ''* strDAT = DateAdd(" d",13,strDAT) arrDAT(intMON,1)= strDAT 下一页 ''* ''*结果 ' '* strDAT ="" 对于intMON = 1到12 strDAT = strDAT& intMON& " ;. strDAT = strDAT& arrDAT(intMON,0)& " :" strDAT = strDAT& arrDAT(intMON,1)& vbCrLf 下一页 MsgBox strDAT,vbInformation,cVBS [...] 这是救命?请注意自动换行。 由于这是一个JavaScript论坛,并且OP明确要求 JavaScript,为什么会''这个''帮助? 选项明确''* ''*声明常数 [...] 也许如果你用适当的语言重写它... - Zif [...] 由于这是一个JavaScript论坛,并且OP明确要求使用JavaScript,为什么这个有帮助? [...] 也许如果你用适当的语言重写它...... Zif OP确实问过是这可能吗? - 这个 (至少)表明它是...... 你当然是对的。我发布到多个小组,有时当我想到解决方案时,我忘记将其自定义为小组。 I would like to return data from the last 2 weeks of each given monthin Javascript, but in 2 formats. So, the penultimate week (Monday to Sunday) and the last week (Mondayto ??) I''m not sure if it can be done, but all help welcomed. E.g. I have December and would like to see the last 2 weeks.. So thisdoesnt mean the last 15 days. What i mean by this is... Sometimes a Week will cross over into 2 months, where it finishes onTuesday and starts on Wednesday, like November 2004 for example. With the November 2004 example, means there are 5 weeks in November..so i would like to see the data within the 4th week (Monday to Sunday)and the 5th week (Monday to Tuesday). Of course for every month of theyear.Is this possible?? I look forward to hearing your thoughts.SimonC 解决方案 Will this help? Watch for word-wrap. Option Explicit''*''* Declare Constants''*Const cVBS = "penuweek.vbs"Const cYER = 2004''*''* Declare Variables''*Dim arrDAT(12,1)Dim intDATDim strDATDim intDOWDim intMONDim strYERstrYER = cYER''*''* 12 Months''*For intMON = 1 To 12''*''* First day of next month''*strDAT = DateSerial(strYER,intMON+1,1)''*''* Last day of this month''*strDAT = DateAdd("d",-1,strDAT)''*''* Day of week''*intDOW = DatePart("w",strDAT,2)''*''* Date of Monday before last''*If intDOW = 1 Then intDOW = 8intDAT = (intDOW + 6) * -1strDAT = DateAdd("d",intDAT,strDAT)arrDAT(intMON,0) = strDAT''*''* Date of Sunday two weeks later''*strDAT = DateAdd("d",13,strDAT)arrDAT(intMON,1) = strDATNext''*''* Results''*strDAT = ""For intMON = 1 To 12strDAT = strDAT & intMON & ". "strDAT = strDAT & arrDAT(intMON,0) & " : "strDAT = strDAT & arrDAT(intMON,1) & vbCrLfNextMsgBox strDAT,vbInformation,cVBS[...] Will this help? Watch for word-wrap. Since this is a JavaScript forum, and the OP has explicitly asked forJavaScript, why would ''this'' help? Option Explicit ''* ''* Declare Constants[...] Perhaps if you re-write it in an appropriate language... --Zif [...] Since this is a JavaScript forum, and the OP has explicitly asked for JavaScript, why would ''this'' help? [...] Perhaps if you re-write it in an appropriate language... -- Zif The OP did ask "Is this possible??" -- "this" (at least) shows that it is...You''re right, of course. I post to multiple groups and sometimes when Ithink of a solution I forget to customize it to the group. 这篇关于每个月的倒数第二周和上周的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-20 22:22