判断星期,自动把上周的累计数据归到上周字段,本周初始化
程序员文章站
2022-03-23 21:37:32
以下是代码片段:ASP/Visual Basic代码<% --判断星期,自动把上周的累计数据归到上周字段,本周初始化 ...
以下是代码片段:
ASP/Visual Basic代码
<%
--判断星期,自动把上周的累计数据归到上周字段,本周初始化
Dim Np,Lp,Lh
-- Lp为上次访问时间
Np = "108"
Lp = "0"
Lh = "2007-9-15 10:27:15"
--如果两个时间相差不足一周,则计入本周累计
If DateDiff("Ww", Lh, Now) <= 0 Then
Response.Write "Np = " & Np+1 & "<br>"
Response.Write "Lp = " & Lp
--如果两个时间相差正好一周,则写入上周,本周初始化为1
ElseIf DateDiff("Ww", Lh, Now) = 1 Then
Response.Write "Np = 1 <br>"
Response.Write "Lp = " & Np
--如果两个时间相差大于一周,则上周清为0,本周初始化为1
Else
Response.Write "Np = 1 <br>"
Response.Write "Lp = 0"
End If
Response.Write "<br><br>距上次访问相差" & DateDiff("Ww", Lh, Now) & "周."
%>
ASP/Visual Basic代码
<%
--判断星期,自动把上周的累计数据归到上周字段,本周初始化
Dim Np,Lp,Lh
-- Lp为上次访问时间
Np = "108"
Lp = "0"
Lh = "2007-9-15 10:27:15"
--如果两个时间相差不足一周,则计入本周累计
If DateDiff("Ww", Lh, Now) <= 0 Then
Response.Write "Np = " & Np+1 & "<br>"
Response.Write "Lp = " & Lp
--如果两个时间相差正好一周,则写入上周,本周初始化为1
ElseIf DateDiff("Ww", Lh, Now) = 1 Then
Response.Write "Np = 1 <br>"
Response.Write "Lp = " & Np
--如果两个时间相差大于一周,则上周清为0,本周初始化为1
Else
Response.Write "Np = 1 <br>"
Response.Write "Lp = 0"
End If
Response.Write "<br><br>距上次访问相差" & DateDiff("Ww", Lh, Now) & "周."
%>
上一篇: MySQL精讲之二:DML数据操作语句
下一篇: php怎么将整型转为字符串