以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 日期设置 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=88582) |
-- 作者:g1j2h3 -- 发布时间:2016/8/5 10:57:00 -- 日期设置 下边这段代码中的日期,我想固定提取上个月的第一天到最后一天的数据(每次都是,不想如下边,一个月一个月的设置),如何设置
For Each dr As DataRow In DataTables("考勤表").Select("岗位代码 = \'" & Ary(0) & "\' and 岗位 = \'" & Ary(1) & "\'and 姓名 = \'" & Ary(2) & "\' and 日期 >= #7/1/2016# And 日期 <= #7/31/2016# ") Dim d As Date = dr("日期") Dim day As String = CStr(d.Day) dr1(day) = dr("上午") dr2(day) = dr("下午") Next [此贴子已经被作者于2016/8/5 11:08:55编辑过]
|
-- 作者:大红袍 -- 发布时间:2016/8/5 11:19:00 -- Dim pd As Date = new Date(Date.Today.Year, Date.Today.Month, 1) For Each dr As DataRow In DataTables("考勤表").Select("岗位代码 = \'" & Ary(0) & "\' and 岗位 = \'" & Ary(1) & "\'and 姓名 = \'" & Ary(2) & "\' and 日期 >= #" & pd.AddMonths(-1) & "# And 日期 < #" & pd & "# ") |