各位都把ASP用的函數(shù)和詳細(xì)說明貼出來,供大家學(xué)習(xí).
我知道的如下:
1.函數(shù)array()
功能:創(chuàng)建一個(gè)數(shù)組變量
格式:array(list)
參數(shù):list 為數(shù)組變量中的每個(gè)數(shù)值列,中間用逗號(hào)間隔
例子:
<% i = array ("1","2","3") %>
結(jié)果: i 被賦予為數(shù)組
2.函數(shù)Cint()
功能:將一表達(dá)式/其它類型的變量轉(zhuǎn)換成整數(shù)類型(int)
格式:Cint(expression)
參數(shù):expression 是任何有效的表達(dá)式/其它類型的變量
例子:
<%
f = "234"
response.write cINT(f) + 2
%>
結(jié)果: 236
函數(shù)Cint()將字符"234"轉(zhuǎn)換 成整數(shù)234.如果表達(dá)式為空, 或者無效時(shí),返回值為0;
3.函數(shù):Creatobject()
功能:創(chuàng)建及返回一個(gè)ActiveX對(duì)象.
格式:Creatobject(obname)
參數(shù)bname 是對(duì)象的名稱
例子:
<%
Set con = Server.CreateObject("ADODB.Connection")
%>
結(jié)果:
4.函數(shù)Cstr()
功能:將一表達(dá)式/其它類型的變量轉(zhuǎn)換成字符類型(string)
格式:Cstr(expression)
參數(shù):expression是任何有效的表達(dá)式/其它類型的變量
例子:
<%
s = 3 + 2
response.write "The result is:" & cStr(s)
%>
結(jié)果:函數(shù)Cstr()將整數(shù) 5 轉(zhuǎn)換 成字符"5".
5.函數(shù)Date()
功能:返回當(dāng)前系統(tǒng)(server端)的日期
格式: Date()
參數(shù):無
例子<% date () %>
結(jié)果:05/10/00
6.函數(shù)Dateadd()
功能:計(jì)算某個(gè)指定的時(shí)間和
格式: dateadd(timeinterval,number,date)
參數(shù):timeinterval是時(shí)間單位(月,日..); number是時(shí)間間隔值,date是時(shí)間始點(diǎn).
例子:
<%
currentDate = #8/4/99#
newDate = DateAdd("m",3,currentDate)
response.write newDate
%> <%
currentDate = #12:34:45 PM#
newDate = DateAdd("h",3,currentDate)
response.write newDate
%>
結(jié)果:
11/4/99
3:34:45 PM
其中
"m" = "month";
"d" = "day";
如果是currentDate 格式,則,
"h" = "hour";
"s" = "second";
7.函數(shù)Datediff()
功能:計(jì)算某量個(gè)指定的時(shí)間差
格式: datediff(timeinterval,date1,date2[,firstdayofweek[,firstdayofyear]])
參數(shù): timeinterval 是時(shí)間單位; date1,date2是有效的日期表達(dá)式,firstdayofweek,firstdayofyear 是任意選項(xiàng).
例子:
<%
fromDate = #8/4/99#
toDate = #1/1/2000#
response.write "There are " & _
DateDiff("d",fromDate,toDate) & _
" days to millenium from 8/4/99."
%>
結(jié)果:There are 150 days to millenium from 8/4/99.
8.函數(shù)day()
功能:返回一個(gè)整數(shù)值,對(duì)應(yīng)于某月的某日