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

2016-01-29 17:12 3 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

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

延伸阅读
VB作为快速开发Windows下的编程工具,已经为越来越多的开发者采用。但如果要开发出专业的Windows软件,还需采用大量的API函数,以下结合笔者开发管理软件的经验谈几点体会。 程序中判定Windows的版本 众所周知,Windows3.x各版本或多或少会有些差别,为了使开发程序避免出现莫名其妙的错误,最好在程序运行前自动判定Windows的版本。采...
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开发
我 爱 你 啊
标签: Web开发
ASP开发中存储过程应用详解|调用,参数,存储,数据库,输出,编译,mycomm,输入,userid,代码 ASP与存储过程(Stored Procedures)的文章不少,但是我怀疑作者们是否真正实践过。我在初学时查阅过大量相关资料,发现其中提供的很多方法实际操作起来并不是那么回事。对于简单的应用,这些资料也许是有帮助的,但仅限于此,因为它们根本就是千篇...
标签: ASP
  Date 函数 描述:返回当前系统日期。 语法:Date DateAdd 函数 描述:返回已添加指定时间间隔的日期。 语法:DateAdd(interval, number, date) interval: 必选。字符串表达式,表示要添加的时间间隔。有关数值,请参阅“设置”部分。 number: 必选。数值表达式,表示要添加的时间间隔的个数。数值表达式可以是正数(得到未来的日期)或负...

经验教程

227

收藏

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