如何获得当前日期为星期几并转换为中文?

programfish 2003-12-24 08:14:55
如上。
...全文
21 点赞 收藏 2
写回复
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
rainstormmaster 2003-12-24

Private Sub Command1_Click()
'调用
Dim mdate As Date
mdate = Now
Debug.Print test(mdate)
End Sub

Private Function test(ByVal mdate As Date) As String
Dim i As Long
i = Weekday(mdate, vbMonday)
Dim s As String
s = "一二三四五六日"
test = "星期" + Mid(s, i, 1)
End Function
回复
fangyds 2003-12-24
Private Sub Form_Load()
Me.AutoRedraw = True

Dim l As Long
Dim strWeek As String
l = Weekday(Now)
Select Case l
Case 1
strWeek = "星期日"
Case 2
strWeek = "星期一"
Case 3
strWeek = "星期二"
Case 4
strWeek = "星期三"
Case 5
strWeek = "星期四"
Case 6
strWeek = "星期五"
Case 7
strWeek = "星期六"
End Select
Print strWeek
End Sub
回复
发动态
发帖子
VB基础类
创建于2007-09-28

7451

社区成员

VB 基础类
申请成为版主
社区公告
暂无公告