设为首页收藏本站Access中国

Office中国论坛/Access中国论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

返回列表 发新帖
查看: 1663|回复: 4
打印 上一主题 下一主题

[模块/函数] 实现日期大写显示

[复制链接]

点击这里给我发消息

跳转到指定楼层
1#
发表于 2002-10-4 09:00:00 | 显示全部楼层 回帖奖励 |倒序浏览 |阅读模式
引贴
实现日期大写显示,显示效果 : 二〇〇二年十月四日
Function Date2Chinese(iDate)
      Dim num(10)
      Dim iYear
      Dim iMonth
      Dim iDay

      num(0) = "〇"
      num(1) = "一"
      num(2) = "二"
      num(3) = "三"
      num(4) = "四"
      num(5) = "五"
      num(6) = "六"
      num(7) = "七"
      num(8) = "八"
      num(9) = "九"

      iYear = Year(iDate)
      iMonth = Month(iDate)
      iDay = Day(iDate)
      Date2Chinese = num(iYear \ 1000) + _
            num((iYear \ 100) Mod 10) + num((iYear _
            \ 10) Mod 10) + num(iYear Mod _
            10) + "年"
      If iMonth >= 10 Then
            If iMonth = 10 Then
                  Date2Chinese = Date2Chinese + _
                  "十" + "月"
            Else
                  Date2Chinese = Date2Chinese + _
                  "十" + num(iMonth Mod 10) + "月"
            End If
      Else
            Date2Chinese = Date2Chinese + _
                  num(iMonth Mod 10) + "月"
      End If
      If iDay >= 10 Then
            If iDay = 10 Then
                  Date2Chinese = Date2Chinese + _
                  "十" + "日"
            ElseIf iDay = 20 Or iDay = 30 Then
                  Date2Chinese = Date2Chinese + _
                  num(iDay \ 10) + "十" + "日"
            ElseIf iDay > 20 Then
                  Date2Chinese = Date2Chinese + _
                  num(iDay \ 10) + "十" + _
                  num(iDay Mod 10) + "日"
            Else
                 Date2Chinese = Date2Chinese + _
                 "十" + num(iDay Mod 10) + "日"
            End If
      Else
            Date2Chinese = Date2Chinese + _
            num(iDay Mod 10) + "日"
      End If
End Function
可自己改改适合自己的需要
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享分享 分享淘帖 订阅订阅
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|站长邮箱|小黑屋|手机版|Office中国/Access中国 ( 粤ICP备10043721号-1 )  

GMT+8, 2024-5-11 20:08 , Processed in 0.084671 second(s), 24 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表