计算你的出生日期是星期几

Private Sub Command1_Click()

Dim Year As Integer

Dim Month As Integer

Dim 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(dayofweek)

End Sub

Function Myweekdayname(dayofweek AsInteger) As String

 Select Case dayofweek

   Case 1

      Myweekdayname = "星期天"

   Case 2

      Myweekdayname = "星期一"

   Case 3

      Myweekdayname = "星期二"

   Case 4

      Myweekdayname = "星期三"

   Case 5

      Myweekdayname = "星期四"

   Case 6

      Myweekdayname = "星期五"

   Case Else

      Myweekdayname = "星期六"

  EndSelect

 EndFunction

 


阅读更多
文章标签: command
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭
关闭