(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
5:asp 小写数字转大写 :
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
6:asp 小写金额转大写 :
Function UMoney(money) Dim lnP,Prc,Tmp,NoB,Dx,Xx,Zhen Dim China : China = "分角元拾佰仟万拾佰仟亿" Dim str: str = Array("零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖") Zhen = True money = FormatNumber(money, 2) Prc = CStr(money) Prc = Replace(Prc, ",", "") lnP = Len(Prc) For i = lnP - 1 To 1 Step -1 If Mid(Prc, i, 1) = "." Then Select Case lnP - i Case 1
Prc = Replace(Prc, ".", "") + "0" Case 2 Prc = Replace(Prc, ".", "") End Select Zhen = False Exit For End If Next If Zhen Then Prc = Prc + "00" lnP = Len(Prc) For i = 1 To lnP Tmp = str(Mid(Prc, i, 1)) &; Tmp Next UMoney = "" fy = 1 For i = 1 To lnP Xx = Mid(Tmp, i, 1) Dx = Mid(China, i, 1) If Xx <> "零" Then UMoney = Xx &; Dx &; UMoney f = 1 Else If i = 3 Then UMoney = Dx &; UMoney End If If i = 7 Then UMoney = Dx &; UMoney End If If f Then UMoney = "零" &; UMoney End If f = 0 End If Next If Zhen Then UMoney = UMoney + "整" UMoney = Replace(UMoney, "零万", "万") UMoney = Replace(UMoney, "零元", "元") End Function
7:asp 随机选取 5 组彩票 :
Fun
ction rndtest(m_count,r_count) ''参数 m_count 号码总数,r_count 为要取出的号码数 dim x,st,i
i=1 st="" do while i<=r_count randomize x=int(rnd*m_count)+1 ''产生 1~m_count 的随机数 if i=r_count then if not instr(st,x)>0 then st=st&;x i=i+1 end if else if not instr(st,x)>0 then st=st&;x&;"," ''用,分割 i=i+1 end if end if if i>=m_count then exit do ''如果 m_count 小于 r_count 将出现死循环,于是判断并跳出循环 end if loop rndtest=st end function
function sort(ary)'冒泡函数 ck=true do Until ck = false ck=false For f = 0 to UBound(ary) -1 if clng(ary(f))>clng(ary(f+1)) then v1=clng(ary(f)) v2=clng(ary(f+1)) ary(f)=v2 ary(f+1)=v1 ck=true end if next loop sort=ary end function for i=0 to 4 Mycount=rndtest(33,7) MyArray=split(Mycount,",")
newArray=sort(MyArray) for i2=0