Foxtable(狐表)用户栏目专家坐堂 → [求助]窗体中日期格式及时间返回的问题请教


  共有9929人关注过本帖树形打印复制链接

主题:[求助]窗体中日期格式及时间返回的问题请教

帅哥哟,离线,有人找我吗?
dreamyuan
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:198 积分:1655 威望:0 精华:0 注册:2013/1/11 15:10:00
  发帖心情 Post By:2013/1/22 12:10:00 [显示全部帖子]

已过期  dr("过期日期") < Date.Today

Dim t As TimeSpan

t = dr("过期日期") - Date.Today

t.day < 30 一个月内 

t.day < 90 1至3个月内


 回到顶部
帅哥哟,离线,有人找我吗?
dreamyuan
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:198 积分:1655 威望:0 精华:0 注册:2013/1/11 15:10:00
  发帖心情 Post By:2013/1/22 12:43:00 [显示全部帖子]

Dim filter As String
Dim sl As String = e.Form.Controls("ComBoBox1").Text
Select Case sl
    Case "已过期"
        filter = "过期日期 <  #" & Date.ToDay & "#"
    Case "一个月内到期"
        filter = "过期日期 > = #" & Date.ToDay & "# And 过期日期 < = #" & Date.Today.AddDays(30) & "#"
    Case "1-3个月到期"
        filter = "过期日期 > = #" & Date.ToDay.AddDays(30) & "# And 过期日期 < = #" & Date.Today.AddDays(90) & "#"
    Case "3-6个月到期"
        filter = "过期日期 > = #" & Date.ToDay.AddDays(90) & "# And 过期日期 < = #" & Date.Today.AddDays(180) & "#"
    Case "6-9个月到期"
        filter = "过期日期 > = #" & Date.ToDay.AddDays(180) & "# And 过期日期 < = #" & Date.Today.AddDays(270) & "#"
    Case "9-12个月到期"
        filter = "过期日期 > = #" & Date.ToDay.AddDays(270) & "# And 过期日期 < = #" & Date.Today.AddDays(360) & "#"
    Case "一年后到期"
        filter = "过期日期 > = #" & Date.ToDay.AddDays(360) & "#"
End Select
Tables("表A").Filter = filter

 回到顶部
帅哥哟,离线,有人找我吗?
dreamyuan
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:198 积分:1655 威望:0 精华:0 注册:2013/1/11 15:10:00
  发帖心情 Post By:2013/1/22 12:43:00 [显示全部帖子]

一个月按30天算,不知道有没有更简单的方法没,这是偶的方法


 回到顶部
帅哥哟,离线,有人找我吗?
dreamyuan
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:198 积分:1655 威望:0 精华:0 注册:2013/1/11 15:10:00
  发帖心情 Post By:2013/1/22 12:51:00 [显示全部帖子]

呵呵, 应该用林老师的更准确改成这样

Dim filter As String
Dim sl As String = e.Form.Controls("ComBoBox1").Text
Select Case sl
    Case "已过期"
        filter = "过期日期 <  #" & Date.ToDay & "#"
    Case "一个月内到期"
        filter = "过期日期 > = #" & Date.ToDay & "# And 过期日期 < = #" & Date.Today.AddMonths(1) & "#"
    Case "1-3个月到期"
        filter = "过期日期 > = #" & Date.ToDay.AddMonths(1) & "# And 过期日期 < = #" & Date.Today.AddMonths(3) & "#"
    Case "3-6个月到期"
        filter = "过期日期 > = #" & Date.ToDay.AddMonths(3) & "# And 过期日期 < = #" & Date.Today.AddMonths(6) & "#"
    Case "6-9个月到期"
        filter = "过期日期 > = #" & Date.ToDay.AddMonths(6) & "# And 过期日期 < = #" & Date.Today.AddMonths(9) & "#"
    Case "9-12个月到期"
        filter = "过期日期 > = #" & Date.ToDay.AddMonths(9) & "# And 过期日期 < = #" & Date.Today.AddYears(1) & "#"
    Case "一年后到期"
        filter = "过期日期 > = #" & Date.ToDay.AddYears(1) & "#"
End Select
Tables("表A").Filter = filter


 回到顶部