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 //判斷周數(shù)是否為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
在屏南等地區(qū),都構(gòu)建了全面的區(qū)域性戰(zhàn)略布局,加強(qiáng)發(fā)展的系統(tǒng)性、市場(chǎng)前瞻性、產(chǎn)品創(chuàng)新能力,以專注、極致的服務(wù)理念,為客戶提供網(wǎng)站設(shè)計(jì)、成都網(wǎng)站制作 網(wǎng)站設(shè)計(jì)制作按需網(wǎng)站開發(fā),公司網(wǎng)站建設(shè),企業(yè)網(wǎng)站建設(shè),品牌網(wǎng)站制作,成都全網(wǎng)營(yíng)銷,外貿(mào)網(wǎng)站制作,屏南網(wǎng)站建設(shè)費(fèi)用合理。
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") '獲得當(dāng)前日期字符串
Dim ThisDateTime As DateTime = Convert.ToDateTime(ThisDay) '當(dāng)前日期轉(zhuǎn)換成DateTime
Dim ThisWeekDay As Integer = ThisDateTime.DayOfWeek '獲得當(dāng)前日期是星期幾
Dim differadd As Integer = 1 - ThisWeekDay '相差的天數(shù)(星期1與當(dāng)前星期幾相差的天數(shù))
Dim MyAdd As New TimeSpan(differadd, 0, 0, 0)
Dim MyYear As Integer = Format(Now, "yyyy") '獲取當(dāng)前日期的年份
Dim MyMonth As Integer = Format(Now, "MM") '獲取當(dāng)前日期的月份
Dim MyDay As Integer = Format(Now, "dd") '獲取當(dāng)前日期是幾號(hào)
Dim MyToday As DateTime = New DateTime(MyYear, MyMonth, MyDay)
Dim Yourday As DateTime = MyToday.Add(MyAdd)
MsgBox("本周星期一的日期是:" Yourday)