您现在的位置: 宁夏家电维修网 >> 网络学院 >> 网页设计 >> 网络编程 >> 教程正文
教程·ASP 系列函数大全
用户登录 新用户注册 【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口

ASP 系列函数大全
作者:德力科技    教程来源:德力科技    点击数:    更新时间:2005-4-30      ★★★★★

ASP函数大全 
ASP函数与VBSCRIPT类似,以下举一些常用的函数 
 
Array() 
 
函数返回一个数组 
 
表达式 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() 
 
函数将一个表达式转化为数字类型 
 
表达式 CInt(expression) 
 
允许数据类型: 任何有效的字符均可 
 
实例: <% 
 
f = "234" 
 
response.write cINT(f) + 2 
 
%> 
 
返回结果: 236 
 
转化字符"234"为数字"234",如果字符串为空,则返回0值 
 
 
CreateObject() 
 
函数建立和返回一个已注册的ACTIVEX组件的实例。 
 
表达式 CreateObject(objName) 
 
允许数据类型: objName 是任何一个有效、已注册的ACTIVEX组件的名字. 
 
实例: <% 
 
Set con = Server.CreateObject("ADODB.Connection") 
 
%> 
 
 
CStr() 
 
函数转化一个表达式为字符串. 
 
表达式 CStr(expression) 
 
允许数据类型: expression 是任何有效的表达式。 
 
实例: <% 
 
s = 3 + 2 
 
response.write "The 返回结果 is: " & cStr(s) 
 
%> 
 
返回结果: 转化数字“5”为字符“5”。 
 
 
Date() 
 
函数返回当前系统日期. 
 
表达式 Date() 
 
允许数据类型: None. 
 
实例: <%=Date%> 
 
返回结果: 9/9/00 
 
 
DateAdd() 
 
函数返回一个被改变了的日期。 
 
表达式 DateAdd(timeinterval,number,date) 
 
允许数据类型: 
timeinterval is the time interval to add; 
number is amount of time intervals to add; 
and date is the starting date. 
 
实例: <% 
 
currentDate = #9/9/00# 
 
newDate = DateAdd("m",3,currentDate) 
 
response.write newDate 
 
%> 
 
 
<% 
 
currentDate = #12:34:45 PM# 
 
newDate = DateAdd("h",3,currentDate) 
 
response.write newDate 
 
%> 
 
返回结果: 9/9/00 
 
3:34:45 PM 
 
"m" = "month"; 
 
"d" = "day"; 
 
If currentDate is in time format then, 
 
"h" = "hour"; 
 
"s" = "second"; 
 
 
DateDiff() 
 
函数返回两个日期之间的差值 。 
 
表达式 DateDiff(timeinterval,date1,date2 [, firstdayofweek [, firstweekofyear]]) 
 
允许数据类型: timeinterval 表示相隔时间的类型,如“M“表示“月”。 
 
实例: <% 
 
fromDate = #9/9/00# 
 
toDate = #1/1/2000# 
 
response.write "There are " & _ 
 
DateDiff("d",fromDate,toDate) & _ 
 
" days to millenium from 9/9/00." 
 
%> 
 
返回结果: 从9/9/00 到2000年还有 150 天. 
 
 
Day() 
 
函数返回一个月的第几日 . 
 
表达式 Day(date) 
 
允许数据类型: date 是任何有效的日期。 
 
实例: <%=Day(#9/9/00#)%> 
 
返回结果: 4 
 
 
FormatCurrency() 
 
函数返回表达式,此表达式已被格式化为货币值 
 
表达式 FormatCurrency(Expression [, Digit [, LeadingDigit [, Paren [, GroupDigit]]]]) 
 
允许数据类型: Digit 指示小数点右侧显示位数的数值。默认值为 -1,指示使用的是计算机的区域设置; LeadingDigit 三态常数,指示是否显示小数值小数点前面的零。

本新闻共4页,当前在第1页  1  2  3  4  


德力科技声明:本站发布的文章或作品版权归作者共有,如有侵权之处,或未注明出自网站及作者姓名,请与德力科技联系。本站所提供的插画,摄影作品,以及文章作品版权归原作者所有。
教程录入:德力科技    责任编辑:德力科技 

  • 上一篇教程:

  • 下一篇教程:


  •  网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)


    解决ASP执行DB查询中的特殊字
    asp中如何限制重复提交同一表
    asp不用DSN访问数据库
    ASP文件上传原理分析及实现实
    asp 用存储过程实现数据分页
    ASP中数据库调用中常见错误的
    ASP 五大高效提速技巧
    ASP+Access的安全隐患及对策
    ASP如何获取真实IP地址
    asp创建对象及中文显示解决技
    © 宁夏·银川德力科技服务有限公司版权所有,保留所有权利