zoukankan      html  css  js  c++  java
  • ASP 生成带日期的随机数

    <%
    Function getRnd()
    '****************************************
    '返回值:如getRnd(),即输出200808241553464617,为2008年08月24日15时53分46秒4617随机数
    '关联函数:formatInt()
    '****************************************
    getRnd = ""
    getRnd = getRnd&formatInt(year(now),4)
    getRnd = getRnd&formatInt(month(now),2)
    getRnd = getRnd&formatInt(day(now),2)
    getRnd = getRnd&formatInt(hour(now),2)
    getRnd = getRnd&formatInt(minute(now),2)
    getRnd = getRnd&formatInt(second(now),2)
    randomize
    ranNum=int((9000*rnd)+1000)
    getRnd = getRnd&ranNum
    End Function
    
    Function formatInt(Expression,Digit)
    '****************************************
    '函数名:formatInt
    '作 用:输出Digit位左边带0整数
    '参 数:Expression ----要格式化整数
    '参 数:Digit ----要格式化位数
    '返回值:如006,如FormatIntNumber(6,3),整数5被格式化为006
    '关联函数:无
    '****************************************
    While Len(Expression) < Digit
    Expression = "0"&Expression
    wend
    formatInt = Expression
    End Function
    
    response.Write(getRnd()&"<br>")
    response.Write(formatInt(24,5))'输出00024
    %>
    

      

  • 相关阅读:
    Iptables 之二扩展模块 nat
    sudo 命令
    7、CentOS6 编译安装
    MySQL5.7 基础之二 DCL DML
    SQL Server 2008R2安装
    6、httpd2.4 编译安装LAMP
    MySQL 基础之一
    gulp
    msbuild
    inno setup
  • 原文地址:https://www.cnblogs.com/uuxanet/p/3282812.html
Copyright © 2011-2022 走看看