代码编写:
Dim Year as Integer
Dim Month as IntegerDim Day as Integer
Dim Dayofweek as Byte
Dim Birthday as Date
Year=Int(Val(Text1.Text))
Month=Int(Val(Text2.Text))
Day=Int(Val(Text3.Text))
Birthday=Dateserial(Year,Month,Day)
Dayofweek=Weekday(Birthday)
Label6.caption=Weekdayname(n)
End sub
Private Function Myweekdayname(Dayofweek as integer)as string
select case n
case 1
Myweekdayname=“星期天”
case 2
Myweekdayname="非星期天"
End select
End Function
本文提供了一个使用Visual Basic编写的简单示例程序,用于将输入的日期转换为对应的星期名称。通过三个文本框接收年、月、日信息,并利用DateSerial函数与Weekday函数计算出指定日期是星期几。
4019

被折叠的 条评论
为什么被折叠?



