在ASP編程和開發中,函數要實現計算時間是非常簡單的,那么asp使用Weekday函數計算項目的結束時間,大家都了解嗎?今天錯新技術頻道小編就給大家具體介紹。
經過思考,代碼寫出來了,放在這里和大家分享一下:
<%starttime=cdate("2013-09-08") '項目開始時間endtime="" '項目結束時間num=8 '項目需要的天數response.write "開始時間:"&starttime&"<br>天數:"&num&"<br>結束時間:"starttime=starttime-1i=1while i <= num starttime=starttime+1 w=weekday(starttime) if w>1 and w<7 then '非周末 endtime=starttime i=i+1 else '周末休息 end ifwendresponse.write endtime%>
(鼠標移到代碼上去,在代碼的頂部會出現四個圖標,第一個是查看源代碼,第二個是復制代碼,第三個是打印代碼,第四個是幫助)
運行一下,即可看到結果。你也可以修改一下里面的項目開始時間和項目天數,再通過萬年歷來比較檢查一下它的計算結果是否正確。
通過錯新技術頻道小編介紹的asp使用Weekday函數計算項目的結束時間,簡單方便快捷的操作方法盡在js.VeVb.com,希望大家繼續支持我們吧!
新聞熱點
疑難解答