'周
Dim intWeekDay As Integer
Dim stDay As DateTime '本周第一天
Dim PstDay As DateTime '上周第一天
intWeekDay = DatePart(DateInterval.Weekday, Today) '取得今天是星期几
stDay = DateAdd(DateInterval.Day, -1 * intWeekDay + 1, Today) '计算本周第一天的日期
PstDay = DateAdd(DateInterval.Day, 7 + 1 - 2, stDay) '计算本周最后一天的日期
Me.DataGridView1.DataSource = caxun(stDay, PstDay, "all", 0).Tables("log")
'月
Dim intMonthDay As Integer
Dim stDay As DateTime '本月第一天
Dim PstDay As DateTime '上月第一天
intMonthDay = DatePart(DateInterval.Day, Today) '取得今天是本月第几天
stDay = DateAdd(DateInterval.Day, -1 * intMonthDay + 1, Today) '计算本月第一天的日期
PstDay = DateAdd(DateInterval.Day, DateTime.DaysInMonth(Today.Year, Today.Month) - 1, stDay) '计算本月最后一天的日期
Me.DataGridView1.DataSource = caxun(stDay, PstDay, "in", 0).Tables("log")
'年
Dim intMonthDay As Integer
Dim stDay As DateTime '本年第一天
Dim PstDay As DateTime '上年第一天
intMonthDay = DatePart(DateInterval.DayOfYear, Today) '取得今天是本年第几天
stDay = DateTime.Parse(Today.Year & "-01-01") '计算本年第一天的日期
PstDay = DateTime.Parse(Today.Year & "-12-31") '计算本年最后一天的日期
欢迎光临 度量快速开发平台-专业、快速的软件定制快开平台 (http://plat.delit.cn/) | Powered by Discuz! X3.2 |