Array()
函數(shù)返回一個數(shù)組
表達式 Array(list)
允許數(shù)據(jù)類型: 字符,數(shù)字均可
實例:
%
Dim myArray()
For i = 1 to 7
Redim Preserve myArray(i)
myArray(i) = WeekdayName(i)
Next
%>
返回結果: 建立了一個包含7個元素的數(shù)組myArray
myArray("Sunday","Monday", ... ... "Saturday")
CInt()
函數(shù)將一個表達式轉化為數(shù)字類型
表達式 CInt(expression)
允許數(shù)據(jù)類型: 任何有效的字符均可
實例:
%
f = "234"
response.write cINT(f) + 2
%>
返回結果: 236
轉化字符"234"為數(shù)字"234",如果字符串為空,則返回0值
CreateObject()
函數(shù)建立和返回一個已注冊的ACTIVEX組件的實例。
表達式 CreateObject(objName)
允許數(shù)據(jù)類型: objName 是任何一個有效、已注冊的ACTIVEX組件的名字.
實例:
%
Set con = Server.CreateObject("ADODB.Connection")
%>
CStr()
函數(shù)轉化一個表達式為字符串.
表達式 CStr(expression)
允許數(shù)據(jù)類型: expression 是任何有效的表達式。
實例:
%
s = 3 + 2
response.write "The 返回結果 is: " cStr(s)
%>
返回結果: 轉化數(shù)字“5”為字符“5”。
Date()
函數(shù)返回當前系統(tǒng)日期.
表達式 Date()
允許數(shù)據(jù)類型: None.
實例:
返回結果: 9/9/00
DateAdd()
函數(shù)返回一個被改變了的日期。
表達式 DateAdd(timeinterval,number,date)
允許數(shù)據(jù)類型:
timeinterval is the time interval to add;
number is amount of time intervals to add;
and date is the starting date.
實例:
%
currentDate = #9/9/00#
newDate = DateAdd("m",3,currentDate)
response.write newDate
%>
%
currentDate = #12:34:45 PM#
newDate = DateAdd("h",3,currentDate)
response.write newDate
%>
返回結果:
9/9/00
3:34:45 PM
"m" = "month";
"d" = "day";
If currentDate is in time format then,
"h" = "hour";
"s" = "second";
DateDiff()
函數(shù)返回兩個日期之間的差值 。
表達式 DateDiff(timeinterval,date1,date2 [, firstdayofweek [, firstweekofyear]])
允許數(shù)據(jù)類型: timeinterval 表示相隔時間的類型,如“M“表示“月”。
實例:
%
fromDate = #9/9/00#
toDate = #1/1/2000#
response.write "There are " _
DateDiff("d",fromDate,toDate) _
" days to millenium from 9/9/00."
%>
返回結果: 從9/9/00 到2000年還有 150 天.
Day()
函數(shù)返回一個月的第幾日 .
表達式 Day(date)
允許數(shù)據(jù)類型: date 是任何有效的日期。
實例:
返回結果: 4
FormatCurrency()
函數(shù)返回表達式,此表達式已被格式化為貨幣值
表達式 FormatCurrency(Expression [, Digit [, LeadingDigit [, Paren [, GroupDigit]]]])
允許數(shù)據(jù)類型: Digit 指示小數(shù)點右側顯示位數(shù)的數(shù)值。默認值為 -1,指示使用的是計算機的區(qū)域設置; LeadingDigit 三態(tài)常數(shù),指示是否顯示小數(shù)值小數(shù)點前面的零。
實例:
%=FormatCurrency(34.3456)%>
返回結果: $34.35
以上就是ASP函數(shù)大全的全部內(nèi)容,希望對大家的學習有所幫助。
您可能感興趣的文章:- ASP防止圖片木馬上傳的代碼
- 如何防范ASP木馬
- asp防止上傳圖片木馬原理解析