前端

img superdullwolf

日期转化汉字最短版

发表于2004/10/3 15:39:00  995人阅读

:-),9行代码,日期转化汉字最短版,好象不能再短了
<SCRIPT LANGUAGE=vbs>
Function D(x)
 if int(split(x,"-")(2)/10)=0 then D=D & F(split(x,"-")(2)) else _
 if split(x,"-")(2) mod 10 =0 then D=D & F(int(split(x,"-")(2)/10)) & "十" else _
 D=D & F(int(split(x,"-")(2)/10)) & "十" & F(split(x,"-")(2) mod 10) 
 D=F(split(x,"-")(0)) & "年" & MonthName(split(x,"-")(1),True) & replace(D,"一十","十") & "日"
end Function
Function F(x)
 for i=1 to len(x) 
  if mid(x,i,1)="0" then F=F & "零" else F=F & left(MonthName(mid(x,i,1),True),1)
 next
end Function
msgbox D(date)
</SCRIPT>
阅读全文
0 0

相关文章推荐

img
取 消
img