vb点虐 求第几周 vb如何显示现在星期几

VB计算一年中某一天在这一年中是第几周

Private Sub btnGo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGo.Click Dim date1 As Date = txtDate.Text Dim date0 = Year(date1) "/01/01" Dim wk = DateDiff("ww", date0, date1, Microsoft.VisualBasic.FirstDayOfWeek.Monday, FirstWeekOfYear.FirstFullWeek) If (wk = 0) Then //判断周数是否为0,为0则为去年最后一周 Dim date2 = Year(date1) - 1 Dim date3 = date2 "/12/31" Dim date4 = date2 "/01/01" wk = DateDiff("ww", date4, date3, Microsoft.VisualBasic.FirstDayOfWeek.Monday, FirstWeekOfYear.FirstFullWeek) End If lblShow.Text = txtDate.Text "是" Year(date1) "第" wk "周!"End Sub

龙马潭网站建设公司创新互联建站,龙马潭网站设计制作,有大型网站制作公司丰富经验。已为龙马潭1000+提供企业网站建设服务。企业网站搭建\外贸营销网站建设要多少钱,请找那个售后服务好的龙马潭做网站的公司定做!

vb点虐 中怎么根据日期算出是周几呢?

Public Function IsRunnian(ByVal n As Integer) As Boolean

Dim res As Boolean

res = False

If n Mod 400 = 0 Then

res = True

End If

If (n Mod 100  0) And (n Mod 4 = 0) Then

res = True

End If

IsRunnian = res

End Function

Public Function Fc(ByVal td As Date) As Byte

Dim y As Integer

Dim m As Integer

Dim d As Integer

Dim yc As Integer

Dim mc As Integer

Dim dc As Integer

y = Year(td)

m = Month(td)

d = Day(td)

dc = d

If IsRunnian(y) Then

mc = Val(Mid("512503514624", m, 1))

Else

mc = Val(Mid("622503514624", m, 1))

End If

yc = ((y Mod 100) \ 4 + (y Mod 100)) Mod 7

Fc = (yc + mc + dc) Mod 7

End Function

vb 计算某天是一年中的第几周

非常简单,没有那么复杂吧?

If Text1.Text = "" Then

MsgBox "", 16, ""   '以下对话框的提示内容自己填写吧!

Exit Sub

End If

If Text2.Text = "" Then

MsgBox "", 16, ""

Exit Sub

End If

If Text3.Text = "" Then

MsgBox "", 16, ""

Exit Sub

End If

If IsNumeric(Text1.Text) = False Or Val(Text1.Text)  9999 Or Val(Text1.Text)  1000 Then

MsgBox "", 16, ""

Exit Sub

End If

If IsNumeric(Text2.Text) = False Or Val(Text1.Text)  12 Or Val(Text1.Text)  1 Then

MsgBox "", 16, ""

Exit Sub

End If

If IsNumeric(Text3.Text) = False Then

MsgBox "", 16, ""

Exit Sub

End If

If Val(Text2.Text) = 1 Or Val(Text2.Text) = 3 Or Val(Text2.Text) = 5 Or Val(Text2.Text) = 7 Or Val(Text2.Text) = 8 Or Val(Text2.Text) = 10 Or Val(Text2.Text) = 12 Then

If Val(Text3.Text)  31 Or Val(Text3.Text)  1 Then

MsgBox "", 16, ""

Exit Sub

End If

ElseIf Val(Text2.Text) = 4 Or Val(Text2.Text) = 6 Or Val(Text2.Text) = 9 Or Val(Text2.Text) = 11 Then

If Val(Text3.Text)  30 Or Val(Text3.Text)  1 Then

MsgBox "", 16, ""

Exit Sub

End If

ElseIf Val(Text2.Text) = 2 Then

If Val(Text1.Text) Mod 4 = 0 Then

If Val(Text3.Text)  29 Or Val(Text3.Text)  1 Then

MsgBox "", 16, ""

Exit Sub

End If

Else

If Val(Text3.Text)  28 Or Val(Text3.Text)  1 Then

MsgBox "", 16, ""

Exit Sub

End If

End If

End If

Dim year1 As String, month1 As String, day As String, Weekday1 As Integer, Weekday2 As String

year1 = Text1.Text

month1 = Text2.Text

day1 = Text3.Text

Weekday1 = Weekday(CDate(year1  "-"  month1  "-"  day1))

Select Case Weekday1

Case 0: Weekday2 = "星期六"

Case 1: Weekday2 = "星期日"

Case 2: Weekday2 = "星期一"

Case 3: Weekday2 = "星期二"

Case 4: Weekday2 = "星期三"

Case 5: Weekday2 = "星期四"

Case 6: Weekday2 = "星期五"

End Select

网站名称:vb点虐 求第几周 vb如何显示现在星期几
URL标题:https://www.cdcxhl.com/article14/ddejede.html

成都网站建设公司_创新互联,为您提供网站设计公司关键词优化小程序开发搜索引擎优化虚拟主机ChatGPT

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联

成都网站建设