Foxtable(狐表)用户栏目专家坐堂 → [求助]如何获取季度、周的数值?


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

主题:[求助]如何获取季度、周的数值?

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2017/9/29 16:24:00 [显示全部帖子]

季度

 

e.DataRow("季度") = (dmm.Month-1) \ 3 + 1

 

周数


Dim s As String = System.Globalization.CultureInfo.CurrentCulture.Calendar.GetWeekOfYear(dmm, Globalization.CalendarWeekRule.FirstDay, DayOfWeek.Monday).ToString

e.DataRow("周") = s

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2017/9/29 16:41:00 [显示全部帖子]

Dim d As Date = Date.Today
Dim fday As Date = new Date(d.Year, d.Month, 1)
Dim finwek As Integer = fday.DayOfWeek
Dim fwekday As Integer = 7 - (finwek)
Dim diffday As Integer = d.Day - fwekday
diffday = iif(diffday > 0, diffday, 1)
Dim wekInMonth As Integer
If diffday Mod 7 = 0 Then
    wekInMonth = math.Floor(diffday / 7) - 1
Else
    wekInMonth = math.Floor(diffday / 7)
End If
wekInMonth += 1 + iif(d.Day > fwekday, 1, 0)
msgbox(wekInMonth)

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2017/9/29 16:49:00 [显示全部帖子]

Dim d As Date = dmm
Dim fday As Date = new Date(d.Year, d.Month, 1)
Dim finwek As Integer = fday.DayOfWeek
Dim fwekday As Integer = 7 - (finwek)
Dim diffday As Integer = d.Day - fwekday
diffday = iif(diffday > 0, diffday, 1)
Dim wekInMonth As Integer
If diffday Mod 7 = 0 Then
    wekInMonth = math.Floor(diffday / 7) - 1
Else
    wekInMonth = math.Floor(diffday / 7)
End If
wekInMonth += 1 + iif(d.Day > fwekday, 1, 0)

e.DataRow("周") = wekInMonth

 回到顶部