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
龍馬潭網(wǎng)站建設(shè)公司創(chuàng)新互聯(lián)建站,龍馬潭網(wǎng)站設(shè)計(jì)制作,有大型網(wǎng)站制作公司豐富經(jīng)驗(yàn)。已為龍馬潭1000+提供企業(yè)網(wǎng)站建設(shè)服務(wù)。企業(yè)網(wǎng)站搭建\外貿(mào)營(yíng)銷網(wǎng)站建設(shè)要多少錢,請(qǐng)找那個(gè)售后服務(wù)好的龍馬潭做網(wǎng)站的公司定做!
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
非常簡(jiǎn)單,沒(méi)有那么復(fù)雜吧?
If?Text1.Text?=?""?Then
MsgBox?"",?16,?""???'以下對(duì)話框的提示內(nèi)容自己填寫吧!
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
網(wǎng)站名稱:vb點(diǎn)虐
求第幾周 vb如何顯示現(xiàn)在星期幾
URL標(biāo)題:http://bm7419.com/article14/ddejede.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站設(shè)計(jì)公司、關(guān)鍵詞優(yōu)化、小程序開(kāi)發(fā)、搜索引擎優(yōu)化、虛擬主機(jī)、ChatGPT
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)