vb 用英文显示系统当前日期为星期几怎么做?
3个回答
展开全部
首先建一函数,进行星期数字与英文的转换
private function english_WeekDay(num as Integer) as string()
select case num
case 1
english_WeekDay="Sunday"
case 2
english_WeekDay="Monday"
case 3
english_WeekDay="Tuesday"
case 4
english_WeekDay="Wednesday"
case 5
english_WeekDay="Thursday"
case 6
english_WeekDay="Friday"
case 7
english_WeekDay="Saturday"
end select
end function
然后假设在一按钮单击事件中进行操作显示
private sub cmdShow_Click()
label1.caption=english_WeekDay(weekday(date))
end sub
这是目前我能想到的方法,不知道还有没有更直接的方法或函数了。
private function english_WeekDay(num as Integer) as string()
select case num
case 1
english_WeekDay="Sunday"
case 2
english_WeekDay="Monday"
case 3
english_WeekDay="Tuesday"
case 4
english_WeekDay="Wednesday"
case 5
english_WeekDay="Thursday"
case 6
english_WeekDay="Friday"
case 7
english_WeekDay="Saturday"
end select
end function
然后假设在一按钮单击事件中进行操作显示
private sub cmdShow_Click()
label1.caption=english_WeekDay(weekday(date))
end sub
这是目前我能想到的方法,不知道还有没有更直接的方法或函数了。
展开全部
Format(Date, "dddd")
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Private Sub Command1_Click()
Label2.Caption = Weekday(Date)
Label3.Caption = Date
'定义转换中文
If Label2 = 1 Then
Label2 = "星期日"
ElseIf Label2 = 2 Then
Label2 = "星期一"
ElseIf Label2 = 3 Then
Label2 = "星期二"
ElseIf Label2 = 4 Then
Label2 = "星期三"
ElseIf Label2 = 5 Then
Label2 = "星期四"
ElseIf Label2 = 6 Then
Label2 = "星期五"
Else
Label2 = "星期六"
End If
End Sub
Label2.Caption = Weekday(Date)
Label3.Caption = Date
'定义转换中文
If Label2 = 1 Then
Label2 = "星期日"
ElseIf Label2 = 2 Then
Label2 = "星期一"
ElseIf Label2 = 3 Then
Label2 = "星期二"
ElseIf Label2 = 4 Then
Label2 = "星期三"
ElseIf Label2 = 5 Then
Label2 = "星期四"
ElseIf Label2 = 6 Then
Label2 = "星期五"
Else
Label2 = "星期六"
End If
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询