格式化日期时间(显示) ’ 参数:n_Flag ’ 1:"yyyy-mm-dd hh:mm:ss" ’ 2:"yyyy-mm-dd" ’ 3:"hh:mm:ss" ’ 4:"yyyy年mm月dd日" ’ 5:"yyyymmdd" ’ 6:"yyyymmddhhmmss" ’ 7:"yy-mm-dd" ’ 8:"yy-mm-dd hh:mm:ss" ’ 9:"yyyy年mm月" ’ 10:"mm/dd/yyyy" ’ ============================================ Function Format_Time(s_Time, n_Flag) Dim y, m, d, h, mi, s Format_Time = "" If IsDate(s_Time) = False Then Exit Function y = cstr(year(s_Time)) if y = "1900" then Exit Function m = right("0"&month(s_Time),2) d = right("0"&day(s_Time),2) h = right("0"&hour(s_Time),2) mi = right("0"&minute(s_Time),2) s = right("0"&second(s_Time),2) Select Case n_Flag Case 1 Format_Time = y & "-" & m & "-" & d & " " & h & ":" & mi & ":" & s Case 2 Format_Time = y & "-" & m & "-" & d Case 3 Format_Time = h & ":" & mi & ":" & s Case 4 Format_Time = y & "年" & m & "月" & d & "日" Case 5 Format_Time = y & m & d case 6 Format_Time= y & m & d & h & mi & s case 7 Format_Time= right(y,2) & "-" & m & "-" & d case 8 Format_Time= right(y,2) & "-" & m & "-" & d & " " & h & ":" & mi & ":" & s Case 9 Format_Time = y & "年" & m & "月" Case 10 Format_Time = m & "/" & d & "/" & y & "/" End Select End Function 小写数字转大写 function int2chn(n) dim i,j,k,strlen,retval,x,y,z,str z=array("零","壹","贰","叁","肆","伍","陆","柒","捌","玖") y=array("","拾","佰","仟") x=Array("","万","亿","万万亿") strlen=len(n) str1=n for i= 1 to strlen j=mid(str1,i,1) retval=retval&z(j) if j>0 then retval=retval&y((strlen-i) mod 4)’如果大于零,加入十进位字符 retval=replace(retval,z(0)&z(0),z(0))’出现两个零只留一个 if ((strlen-i) mod 4)=0 and right(retval,1)=z(0) then retval=left(retval,len(retval)-1)’每四位加入进阶 if ((strlen-i) mod 4)=0 then retval=retval&x(int((strlen-i)/4))’把最后的零去掉 next int2chn=retval end function
|