以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 怎么判定上周有购买过电脑,代码要怎么写 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=188157) |
||||||||
-- 作者:F1216310 -- 发布时间:2023/9/5 13:42:00 -- 怎么判定上周有购买过电脑,代码要怎么写
|
||||||||
-- 作者:有点蓝 -- 发布时间:2023/9/5 13:52:00 -- 参考:http://www.foxtable.com/webhelp/topics/2720.htm Dim y As Integer = Date.Today.Year Dim w As Integer = Date.Today.DayOfWeek \'算出今天是星期几 Dim dt1 As Date = Date.Today.AddDays( - w) \'获取本周的第一天 Dim dt2 As Date = Date.Today.AddDays(6 - w) \'获取本周的最后一天 Dim Filter As String Filter = "购买日期 >= #" & dt1 & "# And 购买日期 <= #" & dt2 & "#" msgbox("本周条件:" & Filter) Dim Filter1 As String = "购买日期 >= #" & dt1.AddDays( - 7) & "# And 购买日期 <= #" & dt2.AddDays( - 7) & "#" msgbox("上周条件:" & Filter1) |
||||||||
-- 作者:listfor -- 发布时间:2023/9/5 14:53:00 --
|
||||||||
-- 作者:有点蓝 -- 发布时间:2023/9/5 15:04:00 -- 如果是ChatGPT提问的代码,以后建议还是不要发上来了。 |