|
|

楼主 |
发表于 2008/1/25 16:45:55
|
显示全部楼层
借鉴别人的,但还是不能太明白道理(#HourDiff=(#BeginHrs-#EndHrs)化为小时数)
Cover_12and18_By_DateTime(#BeginHrs,#EndHrs,#HourDiff,:#Count)
let #Count=0
if #BeginHrs<=12 and #BeginHrs+#HourDiff>=12
add 1 to #Count
end-if
if #BeginHrs<=18 and #BeginHrs+#HourDiff>=18
add 1 to #Count
end-if
let #TempHrs=(#HourDiff+#BeginHrs-12)/24
let #i=0
while #i<=#TempHrs
if #TempHrs>=1
add 1 to #Count
end-if
add 1 to #i
let #TempHrs = #TempHrs-1
end-while
let #TempHrs= (#HourDiff+#BeginHrs-18)/24
let #j=0
while #j<=#TempHrs
if #TempHrs>=1
add 1 to #Count
end-if
add 1 to #j
let #TempHrs=#TempHrs-1
end-while
Cover_12and18_By_DateTime
注:#BeginHrs,#EndHrs分是Begin_Dt和End_Dt的开始时数。
如:Begin_Dt='2007-10-25 18:01'; End_Dt=''2007-10-25 20:30'
则:#BeginHrs=18;#EndHrs=20.5 |
|