1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | Private Function getDay(ByVal intM As Integer, ByVal intW As Integer, ByVal intD As Integer) As Integer Dim intAllD As Integer = DaysInMonth(Now.Year, intM) Dim strWeek As String = intM & "/1/" & Now.Year Dim dteWeek As Date = Date.Parse(strWeek) Dim intDay As Integer = 0 Dim intWeek As Integer = dteWeek.DayOfWeek If intWeek = 0 Then intWeek = 7 If intWeek < intD Then If intW = 1 Then intDay = (intD - intWeek) + 1 Else intDay = ((intD - intWeek) + 1) + ((intW * 7) - 7) End If ElseIf intWeek = intD Then If intW = 1 Then intDay = 1 Else intDay = 1 + ((intW * 7) - 7) End If Else If intW = 1 Then intDay = ((7 + intD) - intWeek) + 1 Else intDay = (((7 + intD) - intWeek) + 1) + ((intW * 7) - 7) End If End If If intDay > intAllD Then Return 0 Else Return intDay End If End Function |
2020年6月11日 星期四
vb.net 顯示第幾個星期幾的日期 [Show Date by WeekDay]
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言