VB编写一个将日期值转换为中文字符串格式的函数并调用
编写一个将日期值转换为中文字符串日期格式的函数CCDate$(dasDate)并调用,例如将#2010-3-30#转换为“二Ο一Ο年三月三十日”...
编写一个将日期值转换为中文字符串日期格式的函数CCDate$(d as Date)并调用,例如将#2010-3-30#转换为“二Ο一Ο年三月三十日”
展开
3个回答
展开全部
Public Function CCDate$(ByVal MyDate As Date)
y = CStr(Year(MyDate)): m = Month(MyDate): d = Day(MyDate)
For i = 1 To 4
CCDate = CCDate & Mid("Ο一二三四五六七八九", Val(Mid(y, i, 1)) + 1, 1)
Next
CCDate = CCDate & "年"
CCDate = CCDate & Trim(Mid("一 二 三 四 五 六 七 八 九 十 十一十二", m * 2 - 1, 2)) & "月"
CCDate = CCDate & Trim(Mid(" 十二十三十", (d \ 10) * 2 + 1, 2)) & Trim(Mid(" 一二三四五六七八九", (d Mod 10) + 1, 1)) & "日"
End Function
'请注意 字符串中 看不到的空格 别少了
y = CStr(Year(MyDate)): m = Month(MyDate): d = Day(MyDate)
For i = 1 To 4
CCDate = CCDate & Mid("Ο一二三四五六七八九", Val(Mid(y, i, 1)) + 1, 1)
Next
CCDate = CCDate & "年"
CCDate = CCDate & Trim(Mid("一 二 三 四 五 六 七 八 九 十 十一十二", m * 2 - 1, 2)) & "月"
CCDate = CCDate & Trim(Mid(" 十二十三十", (d \ 10) * 2 + 1, 2)) & Trim(Mid(" 一二三四五六七八九", (d Mod 10) + 1, 1)) & "日"
End Function
'请注意 字符串中 看不到的空格 别少了
展开全部
Private Function CCDate$(d As Date)
CCDate = fun(Year(d)) & "年" & fun(Month(d)) & "月" & fun(Day(d)) & "日"
CCDate = Replace(CCDate, "〇日", "十日")
End Function
Private Function fun$(n As Integer)
For i = 1 To Len(CStr(n))
fun = fun + Choose(Val(Mid(CStr(n), i, 1)) + 1, "〇", "一", "二", "三", "四", "五", "六", "七", "八", "九")
Next
End Function
CCDate = fun(Year(d)) & "年" & fun(Month(d)) & "月" & fun(Day(d)) & "日"
CCDate = Replace(CCDate, "〇日", "十日")
End Function
Private Function fun$(n As Integer)
For i = 1 To Len(CStr(n))
fun = fun + Choose(Val(Mid(CStr(n), i, 1)) + 1, "〇", "一", "二", "三", "四", "五", "六", "七", "八", "九")
Next
End Function
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Public Function CCDate$(ByVal MyDate As Date)
y = CStr(Year(MyDate)): m = Month(MyDate): d = Day(MyDate)
For i = 1 To 4
CCDate = CCDate & Mid("Ο一二三四五六七八九", Val(Mid(y, i, 1)) + 1, 1)
Next
CCDate = CCDate & "年"
CCDate = CCDate & Trim(Mid("一 二 三 四 五 六 七 八 九 十 十一十二", m * 2 - 1, 2)) & "月"
CCDate = CCDate & Trim(Mid(" 十二十三十", (d \ 10) * 2 + 1, 2)) & Trim(Mid(" 一二三四五六七八九", (d Mod 10) + 1, 1)) & "日"
End Function
y = CStr(Year(MyDate)): m = Month(MyDate): d = Day(MyDate)
For i = 1 To 4
CCDate = CCDate & Mid("Ο一二三四五六七八九", Val(Mid(y, i, 1)) + 1, 1)
Next
CCDate = CCDate & "年"
CCDate = CCDate & Trim(Mid("一 二 三 四 五 六 七 八 九 十 十一十二", m * 2 - 1, 2)) & "月"
CCDate = CCDate & Trim(Mid(" 十二十三十", (d \ 10) * 2 + 1, 2)) & Trim(Mid(" 一二三四五六七八九", (d Mod 10) + 1, 1)) & "日"
End Function
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询