ASP Common functions

Source: Internet
Author: User
ASP Common functions

Array ()
FUNCTION: Returns an array
Syntax:array (list)
ARGUMENTS: Characters, numbers can be
EXAMPLE: <%
Dim MyArray ()
For i = 1 to 7
Redim Preserve myarray (i)
MyArray (i) = WeekdayName (i)
Next
%>
Result: An array containing 7 elements was created MyArray
MyArray ("Sunday", "Monday", ...) "Saturday")
 
CInt ()
FUNCTION: Converts an expression to a numeric type
Syntax:cint (expression)
ARGUMENTS: Any valid character can be
EXAMPLE: <%
F = "234"
Response.Write CINT (f) + 2
%>
result:236
The conversion character "234" is the number "234" and returns a value of 0 if the string is empty
 
CreateObject ()
FUNCTION: Establishes and returns an instance of a registered ActiveX component.
Syntax:createobject (objname)
Arguments:objname is the name of any valid, registered ActiveX component.
EXAMPLE: <%
Set con = Server.CreateObject ("ADODB.") Connection ")
%>
Result:
 
CSTR ()
FUNCTION: Converts an expression to a string.
SYNTAX:CSTR (expression)
Arguments:expression is any valid expression.
EXAMPLE: <%
s = 3 + 2
Response.Write "The result is:" & CStr (s)
%>
Result: Converts the number "5" to the character "5".
 
Date ()
FUNCTION: Returns the current system date.
Syntax:date ()
Arguments:none.
EXAMPLE: <%=Date%>
Result:8/4/99
 
DATEADD ()
FUNCTION: Returns a date that has been changed.
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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.