Today I saw a post asking for the time to complete the project, and the requirements are as follows:
Give you a project start time, give you the total number of days required by the project, and find the project end time of the project? Note: Saturday and Sunday are off days.
In asp programming development, it is easy to calculate the time. You can get the project end time by directly using the project start time + days, but here is the trouble of eliminating the two breaks of Saturday and Sunday.
After thinking about it, the code has been written and I will share it with you here:
<%starttime=cdate(2013-09-08) 'Project start time endtime= 'Project end time num=8 'The number of days required by the project response.write Start time: &starttime&<br>Number of days: &num&<br>End time: starttime =starttime-1i=1while i <= numstarttime=starttime+1w=weekday(starttime) if w>1 and w<7 then 'non-weekend endtime=starttimei=i+1else 'wend rest end ifwendresponse.write endtime%>
(When the mouse moves to the code, four icons will appear at the top of the code. The first is to view the source code, the second is to copy the code, the third is to print the code, and the fourth is to help)
Run it and you will see the results. You can also modify the project start time and project days in it, and then compare and check whether its calculation results are correct through the perpetual calendar.