1个回答
展开全部
'一年里面的第几天
Private Sub Command1_Click()
Dim y%, m%, d%
y = Val(Text1.Text)
m = Val(Text2.Text)
d = Val(Text3.Text)
If y > 12 And y < 1 Then MsgBox "年份错误"
If m > 12 And y < 1 Then MsgBox "月份错误"
If d > 31 And y < 1 Then MsgBox "日期错误"
If y Mod 400 = 0 Or (y Mod 4 = 0 And y Mod 100 <> 0) Then MsgBox Text1.Text & "年是润年!"
Label1.Caption = "这是今年的第" & DateDiff("d", DateSerial(y, 1, 1), DateSerial(y, m, d)) + 1 & "天!"
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询