vbScript: 编号成生不夠位數前面加零

'编号成生Geovin Du
'不夠位數前面加零 塗聚文
Function getStringlen(str,lenint)
 so=""
  itop=0
  slen=Len(str)
  itop=lenint-slen
  i=0
  if(slen<lenint) then
     for i=1 to itop
      so="0"&so
      Response.Write so&itop&"<br/>"
     Next  
  end if
  getStringlen=so&str
End Function

syear=year(now)
smonth=Right("0" & Month(Now),2)
sday=Right("0" & Day(Now),2)
shour=Right("0" & Hour(Now),2)
sminute=Right("0" & Minute(Now),2)
ssecond=Right("0" & Second(Now),2)
'Right("0" & Month(Now),2)  & "-" & _
'Right("0" & Day(Now),2)  & "_" & _  
'Right("0" & Hour(Now),2) & _
'Right("0" & Minute(Now),2) '   
'& _    Right("0" & Second(Now),2) 
sid=getStringlen(332,8)
smaxid=syear&smonth&sday&shour&sminute&ssecond&sid
MaxId=year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&MaxId

 

你可能感兴趣的:(VBScript)