asp日期转换成汉字格式程序
作者:sunfeng 来源:风之相随'S BLOG 时间:2008-07-08 18:19:00
今天要处理通知书上的日期,写的一个处理程序,效率可能不是最优的,不过实现功能绝对没问题。
注:月份和天要分>10,=10,<10三种情况来处理,否则转换出来的数据会很别扭的哦!!!
<%
'============================
'@ author:sunfeng
'@ http://www.windsfly.cn/blog
'@ email:sf0223cn@163.com
'@ qq:729028242
'============================
function convertNumtoStr(num)
select case num
case 1:convertNumtoStr="一"
case 2:convertNumtoStr="二"
case 3:convertNumtoStr="三"
case 4:convertNumtoStr="四"
case 5:convertNumtoStr="五"
case 6:convertNumtoStr="六"
case 7:convertNumtoStr="七"
case 8:convertNumtoStr="八"
case 9:convertNumtoStr="九"
case 0:convertNumtoStr="十"
end select
end function
da=date() '可从数据库读取,这里只做测试
m=month(da)
d=day(da)
'Response.Write "###"&convertNumtoStr(m)&"-"&convertNumtoStr(d)&"###"
dat=cstr(da)
daa=split(dat,"-")
if int(m)>10 then
mm="十"&convertNumtoStr(right(m,1))
elseif int(m)=10 then
mm="十"
else
mm=convertNumtoStr(m)
end if
if int(d)>10 then
dd=convertNumtoStr(left(d,1))&"十"&convertNumtoStr(right(d,1))
elseif int(d)=10 then
dd="十"
else
dd=convertNumtoStr(d)
end if
Response.Write mm&"-"&dd
'Response.Write "<br>测试成功@!!!"
%>
标签:日期,汉字,转换,asp
0
投稿
猜你喜欢
Python实现字典按照value进行排序的方法分析
2022-11-03 04:27:27
js判断变量是否未定义的代码
2023-08-16 03:43:27
基于Python实现图片九宫格切图程序
2023-11-01 21:16:38
Golang与python线程详解及简单实例
2023-03-13 18:55:25
phpmyadmin显示utf8_general_ci中文乱码的问题终级篇
2024-04-30 09:57:56
TCP协议用在python和wifi模块之间详解
2021-02-04 05:43:08
Pandas标记删除重复记录的方法
2022-04-26 13:53:31
Python Multiprocessing多进程 使用tqdm显示进度条的实现
2021-04-03 19:15:08
Python创建模块及模块导入的方法
2023-04-21 03:42:03
Beego中ORM操作各类数据库连接方式详细示例
2024-01-20 08:07:07
基于 Python实现云服务器的CDN域名远程鉴权配置
2023-07-31 20:44:51
认识延迟时间为 0 的 setTimeout
2008-04-04 16:37:00
python中必会的四大高级数据类型(字符,元组,列表,字典)
2023-01-10 00:54:20
2010 图标设计趋势
2010-12-17 12:44:00
对MySQL慢查询日志进行分析的基本教程
2024-01-22 20:32:35
sqlserver、mysql获取连接字符串步骤
2024-01-22 00:49:33
详解Python中的魔法函数与量子计算模拟
2021-05-18 23:13:47
500行代码使用python写个微信小游戏飞机大战游戏
2023-01-16 06:58:09
怎么样在网页上读取远程xml的数据
2008-10-10 17:43:00
python构造IP报文实例
2023-07-10 20:40:51