应留言板中的网友:sxczw8211请求,写了这样的一个函数.
'函数功能:把日期转化为中文表示格式 '使用方法: 'Print date_w2e("2004-12-31") '二〇〇四年十二月三十一日 Function date_w2e(ByVal myDate As Date) As String Dim eDate As String Dim intY, intM, intD As Integer Dim intD2 As Integer Dim I As Integer
intY = Year(myDate) intM = Month(myDate) intD = Day(myDate)
For I = 1 To Len(intY) eDate = eDate & number_w2e(Mid(intY, I, 1)) Next eDate = eDate & "年"
eDate = eDate & number_w2e(intM) eDate = eDate & "月"
Select Case intD Case 1 To 9, 10, 20, 30 eDate = eDate & number_w2e(intD) Case 11 To 19 eDate = eDate & number_w2e(10) & number_w2e(Mid(intD, 2, 1)) Case 21 To 29 eDate = eDate & number_w2e(20) & number_w2e(Mid(intD, 2, 1)) Case 31 eDate = eDate & number_w2e(30) & number_w2e(1) End Select eDate = eDate & "日"
date_w2e = eDate End Function Function number_w2e(ByVal I As Integer) As String Select Case I Case 0 number_w2e = "〇" Case 1 number_w2e = "一" Case 2 number_w2e = "二" Case 3 number_w2e = "三" Case 4 number_w2e = "四" Case 5 number_w2e = "五" Case 6 number_w2e = "六" Case 7 number_w2e = "七" Case 8 number_w2e = "八" Case 9 number_w2e = "九" Case 10 number_w2e = "十" Case 11 number_w2e = "十一" Case 12 number_w2e = "十二" Case 20 number_w2e = "二十" Case 30 number_w2e = "三十" End Select End Function
|