Access开发培训
网站公告
·Access专家课堂QQ群号:151711184    ·Access快速开发平台下载地址及教程    ·欢迎加入Access专家课堂微信群!    ·如何快速搜索本站文章|示例|资料    
您的位置: 首页 > 技术文章 > Access数据库-模块/函数/VBA

把日期转化为中文表示格式

时 间:2007-10-18 21:39:18
作 者:huangha   ID:42  城市:广州
摘 要:把日期转化为中文表示格式
正 文:

作者:huanghai
来源:www.accessqq.com

'函数功能:把日期转化为中文表示格式
'使用方法:
'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

Access软件网QQ交流群 (群号:54525238)       Access源码网店

常见问答:

技术分类:

相关资源:

专栏作家

关于我们 | 服务条款 | 在线投稿 | 友情链接 | 网站统计 | 网站帮助