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

美好人生是福

美好人生是福

2016-01-29 17:12

ASP中的函数应用方法及应用举例(一),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
展开更多 50%)
分享

猜你喜欢

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

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

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

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

s8lol主宰符文怎么配

英雄联盟 网络游戏
s8lol主宰符文怎么配

ASP中字符串函数的应用

ASP
ASP中字符串函数的应用

Excel截取中文的综合函数应用举例

电脑入门
Excel截取中文的综合函数应用举例

lol偷钱流符文搭配推荐

英雄联盟 网络游戏
lol偷钱流符文搭配推荐

Excel中VLOOKUP函数的应用

电脑入门
Excel中VLOOKUP函数的应用

java中数组的应用及方法

编程语言 网络编程
java中数组的应用及方法

lolAD刺客新符文搭配推荐

英雄联盟
lolAD刺客新符文搭配推荐

使系统最优 谈虚拟内存的合理设置

使系统最优 谈虚拟内存的合理设置

一个BBS的源代码(六)

一个BBS的源代码(六)
下拉加载更多内容 ↓