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

programfish 2003-12-24 08:14:55
如上。
...全文
100 2 打赏 收藏 举报
写回复
2 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
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基础类

7635

社区成员

VB 基础类
社区管理员
  • VB基础类社区
加入社区
帖子事件
创建了帖子
2003-12-24 08:14
社区公告
暂无公告