ASP function Daquan Analytic _asp Foundation

Source: Internet
Author: User

Array () 
function returns an array of
expression Array (list)
allow data types: characters, numbers can
Example:

<%
Dim myarray () for
i = 1 to 7
Redim Preserve myarray (
i) myarray
(i) = WeekdayName (i) next
   %>

Return result: An array containing 7 elements was established myarray
myarray ("Sunday", "Monday", ...) "Saturday")

CInt ()
function Converts an expression to a numeric type
expression CInt (expression)
allow data type: Any valid character can be
Example:

<%
f = "234"
Response.Write CINT (f) + 2
%>

return Result: 236
The conversion character "234" is the number "234" and returns a value of 0 if the string is empty

CreateObject ()
function to establish and return an instance of a registered ActiveX component .
expression CreateObject (objname)
allow data type: objname is the name of any valid, registered ActiveX component.
Example:

<%
Set con = Server.CreateObject ("ADODB.") Connection ")
%>

CSTR ()
function to convert an expression to a string.
expression of CStr (expression)
allow data type: expression is any valid expression.
Example:

<%
s = 3 + 2
Response.Write "The return result is:" & CStr (s)
%>

Return Result: Converts the number "5" to the character "5".

Date ()
function to return the current system date.
An expression Date ()
allow data type: None.
Example:

<%=Date%>

return Result: 9/9/00


DateAdd ()
The function returns a date that has been changed.
expression DateAdd (timeinterval,number,date)
allow data type:
TimeInterval is the time interval to add;
Number is amount of time intervals to add;
And date is the starting date.
Example:

<%
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
% >

return Result:

9/9/00
3:34:45 PM
"M" = "month";
"D" = "Day";
If currentdate is in the time format then,
" h" = "hour";
" S" = "second";

DateDiff ()
function returns the difference between two dates.
expression DateDiff (timeinterval,date1,date2 [, FirstDayOfWeek [, FirstWeekOfYear]])
allow data type: TimeInterval represents a type of time separated, such as "M" for "month".
Example:

<%
fromdate = #9/9/00#
toDate = #1/1/2000# Response.Write
"There are" & _
DateDiff ("D", Fromdate,todate) & _
"Days to Millenium from 9/9/00."
%>

Return result: There are 150 days from 9/9/00 to 2000.

Day ()
function returns the day ordinal of a one-month period.
Expression Day (date)
Allow data type: Date is any valid day.
Example:

<%=day (#9/9/00#)%>

Return Result: 4

FormatCurrency ()
function returns an expression that has been formatted as a currency value
expression FormatCurrency (Expression [, Digit [, Leadingdigit [, Paren [, Groupdigit]] ]
allow data type: Digit indicates the number of digits displayed to the right of the decimal point. The default value is-1, which indicates that the computer's locale is being used; Leadingdigit a three-state constant that indicates whether to display 0 of the decimal point in the front.
Example:

 <%=formatcurrency (34.3456)%>

return Result: $34.35

The above is the full content of ASP functions, I hope to help you learn.

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.