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
在屏南等地区,都构建了全面的区域性战略布局,加强发展的系统性、市场前瞻性、产品创新能力,以专注、极致的服务理念,为客户提供网站设计、成都网站制作 网站设计制作按需网站开发,公司网站建设,企业网站建设,品牌网站制作,成都全网营销,外贸网站制作,屏南网站建设费用合理。
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
Dim ThisDay As String = Format(Now, "yyyy-MM-dd") '获得当前日期字符串
Dim ThisDateTime As DateTime = Convert.ToDateTime(ThisDay) '当前日期转换成DateTime
Dim ThisWeekDay As Integer = ThisDateTime.DayOfWeek '获得当前日期是星期几
Dim differadd As Integer = 1 - ThisWeekDay '相差的天数(星期1与当前星期几相差的天数)
Dim MyAdd As New TimeSpan(differadd, 0, 0, 0)
Dim MyYear As Integer = Format(Now, "yyyy") '获取当前日期的年份
Dim MyMonth As Integer = Format(Now, "MM") '获取当前日期的月份
Dim MyDay As Integer = Format(Now, "dd") '获取当前日期是几号
Dim MyToday As DateTime = New DateTime(MyYear, MyMonth, MyDay)
Dim Yourday As DateTime = MyToday.Add(MyAdd)
MsgBox("本周星期一的日期是:" Yourday)