作用:返回一个数组
语法:Array(list)
适用的类型:字符,数字均可
<% Dim myArray() For i = 1 to 7 Redim Preserve myArray(i) myArray(i) = WeekdayName(i) Next %>
结果:建立了一个包含7个元素的数组myArray
myArray("Sunday","Monday", ... ... "Saturday")
作用:将一个表达式转化为数字类型
语法:CInt(表达式)
适用的类型:任何有效的字符均可
<% f = "234" response.write cINT(f) 2 %>
结果:236
转化字符"234"为数字234,假如字符串为空,则返回0值
作用: 建立和返回一个已注册的ACTIVEX组件的实例。
语法: CreateObject(objName)
适用的类型: objName 是任何一个有效、已注册的ACTIVEX组件的名字.
<%
Set con = Server.CreateObject("ADODB.Connection")
%>作用: 转化一个表达式为字符串.
语法: CStr(expression)
适用类型: expression 是任何有效的表达式
<%
s = 3 2
response.write("The 结果 is: " & cStr(s))
%>
结果: 转化数字5为字符“5”。
作用: 返回当前系统日期.
语法: Date()
适用的类型: None.
<%=Date%>
结果: 8/4/99
作用: 返回一个被改变了的日期。
语法: DateAdd(timeinterval,number,date)
说明: timeinterval为所要加入的时间间隔类型; number 为要添加的数量; date 为起始日期.
<% 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 %>
结果: 11/4/99
3:34:45 PM
"m" = "month";
"d" = "day";
当当前日期格式为time,那么
"h" = "hour";
"s" = "second";
作用: 返回两个日期之间的差值 。
语法: DateDiff(timeinterval,date1,date2 [, firstdayofweek [, firstweekofyear >>)
说明: timeinterval 表示相隔时间的类型,如“M“表示“月”。
<%
fromDate = #8/4/99#
toDate = #1/1/2000#
response.write("There are " & _
DateDiff("d",fromDate,toDate) & _
" days to millenium from 8/4/99."
%>
结果: There are150daysto millenium from 8/4/99.
作用: 返回一个月的第几日 .
语法: Day(date)
说明: date 是任何有效的日期。
<%=Day(#8/4/99#)%>
结果: 4
作用: 返回表达式,此表达式已被格式化为货币值
语法: FormatCurrency(Expression [, Digit [, LeadingDigit [, Paren [, GroupDigit >>>>)
说明: Digit 指示小数点右侧显示位数的数值。默认值为 -1,指示使用的是计算机的区域设置; LeadingDigit 三态常数,指示是否显示小数值小数点前面的零
评论加载中…
![]() |