ASP中的函数应用方法及应用举例(一)

2016-01-29 17:12 6 1 收藏

ASP中的函数应用方法及应用举例(一),ASP中的函数应用方法及应用举例(一)

【 tulaoshi.com - ASP 】

  1.Array()
  FUNCTION: Returns a variant containing an array.
  SYNTAX: Array(list)
  ARGUMENTS: list is a comma-delimited list of values to add to the array.
  EXAMPLE: <%
Dim myArray()
For i = 1 to 7
   Redim Preserve myArray(i)
   myArray(i) = WeekdayName(i)
Next
%
  RESULT: Creates an Array contains 7 elements:
myArray("Sunday","Monday", ... ... "Saturday")
-------------------------------------
  
2. CInt()
  FUNCTION: Returns an expression that has been converted to an Interget subtype.
  SYNTAX: CInt(expression)
  ARGUMENTS: expression is any valid expression
  EXAMPLE: <%
f = "234"
response.write cINT(f) + 2
%
  RESULT: 236
Converts string "234" to mathematic value 234.
If f is empty (un-initialized variable), cINT() returns 0.
-------------------------------------
  
3. CreateObject()
  FUNCTION: Creates and returns a reference to ActiveX automation object.
  SYNTAX: CreateObject(objName)
  ARGUMENTS: objName is any valid ActiveX automation object.
  EXAMPLE: <%
Set con = Server.CreateObject("ADODB.Connection")
%
  RESULT:  
-------------------------------------
  
4. CStr()
  FUNCTION: Returns an expression that has been converted to a variant of subtype String.
  SYNTAX: CStr(expression)
  ARGUMENTS: expression is any valid expression
  EXAMPLE: <%
s = 3 + 2
response.write "The result is: " & cStr(s)
%
  RESULT: Converts a mathematic value 5 to a string "5".
-------------------------------------
  
5. Date()
  FUNCTION: Returns the current system date.
  SYNTAX: Date()
  ARGUMENTS: None.
  EXAMPLE: <%=Date%
  RESULT: 8/4/99
-------------------------------------
  
6. DateAdd()
  FUNCTION: Returns a date to which a specific time interval has been added.
  SYNTAX: DateAdd(timeinterval,number,date)
  ARGUMENTS: timeinterval is the time interval to add; number is amount of time intervals to add; and date
is the starting date.
  EXAMPLE: <%
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
%
  RESULT: 11/4/99
3:34:45 PM

"m" = "month";
"d" = "day";

If currentDate is in time format then,
"h" = "hour";
"s" = "second";
-------------------------------------
  
7. DateDiff()
  FUNCTION: Returns the number of intervals between two dates.
  SYNTAX: DateDiff(timeinterval,date1,date2 [, firstdayofweek [, firstweekofyear]])
  ARGUMENTS: timeinterval is the time interval to add; date is a valid date expression; firstdayofweek and
firstweekofyear are optional values to specify the first day of the week and first week of year.
  EXAMPLE: <%
fromDate = #8/4/99#
toDate = #1/1/2000#
response.write "There are " & _
   DateDiff("d",fromDate,toDate) & _
   " days to millenium from 8/4/99."
%
  RESULT: There are 150 days to millenium from 8/4/99.
-------------------------------------
  
8. Day()
  FUNCTION: Returns a whole number representing the day of the month.
  SYNTAX: Day(date

来源:http://www.tulaoshi.com/n/20160129/1500636.html

延伸阅读
标签: 电脑入门
Excel中Text 函数将数值转换为按指定数字格式表示的文本。 语法:TEXT(value,format_text) Value 为数值、计算结果为数字值的公式,或对包含数字值的单元格的引用。 Format_text 为单元格格式对话框中数字选项卡上分类框中的文本形式的数字格式。 说明: Format_text 不能包含星号 (*)。通过格式菜单调用单元格命令,然后在数字选项卡上设...
excel函数应用   连续区域中index函数的公式格式是=index((array_1,array_2,....),row_number,column_number,array_number)  ,其中array_1,array_2,.....表示我们要查找的几个区域,row_number表示第几行查找,column_number表示在第几列查找,array_numb(www.tulaoshi.com)er表示在第几个区域查找,最终的结果就是查找区域内...
标签: Web开发
我 爱 你 啊
标签: ASP
  Date 函数 描述:返回当前系统日期。 语法:Date DateAdd 函数 描述:返回已添加指定时间间隔的日期。 语法:DateAdd(interval, number, date) interval: 必选。字符串表达式,表示要添加的时间间隔。有关数值,请参阅“设置”部分。 number: 必选。数值表达式,表示要添加的时间间隔的个数。数值表达式可以是正数(得到未来的日期)或负...
标签: ASP
        由于TeeChart VCL 版本广泛应用于多种开发环境并得到很好的认可,西班牙Steema Software SL公司于1997年10月又开发了TeeChart Pro ActiveX。对于B/S的开发模式无疑是一个好消息,由于它只需安装在服务器端,客户端无需安装其他软件,只要使用通用浏览器即可显示统计图形,因此一面市更是又一次得到极大...

经验教程

112

收藏

64
微博分享 QQ分享 QQ空间 手机页面 收藏网站 回到头部