The function of ASP is detailed

Source: Internet
Author: User
Tags date format array expression numeric value string time interval valid
function | Detailed join (expression, "connector")
Split: Receives the relevant parameters and makes them an array.


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 rounded integer of numeric type, related functions:
CSng Cdbl into real numbers!
   
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)
Response.Write Newdate
%>
Result:11/4/99
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.
Syntax:datediff (Timeinterval,date1,date2 [, FirstDayOfWeek [, FirstWeekOfYear]])
The arguments:timeinterval represents the type of time separated, as "M" means "month."
EXAMPLE: <%
FromDate = #8/4/99#
ToDate = #1/1/2000#
Response.Write "There are" & _
DateDiff ("D", Fromdate,todate) & _
"Millenium from 8/4/99."
%>
Result: There are 150 days from 8/4/99 to 2000.

Day ()
FUNCTION: Returns the day ordinal of a one-month period.
Syntax:day (date)
Arguments:date is any valid date.
EXAMPLE: <%=day (#8/4/99#)%>
Result:4

FormatCurrency ()
FUNCTION: Returns an expression that has been formatted as a currency value
Syntax:formatcurrency (Expression [, Digit [, Leadingdigit [, Paren [, Groupdigit]]]
Arguments: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)%>
Result: $34.35

FormatDateTime ()
FUNCTION: Returns an expression that has been formatted as a date or time
Syntax:formatdatetime (Date, [, NamedFormat])
Arguments:namedformat indicates the value of the date/time format used, and if omitted, uses Vbgeneraldate.
EXAMPLE: <%=formatdatetime ("08/4/99", vbLongDate)%>
Result:wednesday, August 04, 1999

FormatNumber ()
FUNCTION: Returns an expression that has been formatted as a numeric value.
Syntax:formatnumber (Expression [, Digit [, Leadingdigit [, Paren [, Groupdigit]]]
Arguments: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 I 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.; Paren 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.; Groupdigit I 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 ...
EXAMPLE: <%=formatnumber (45.324567, 3)%>
result:45.325

FormatPercent ()
FUNCTION: Returns an expression that has been formatted as a percentage of the trailing% symbol (multiplied by 100). (%)
Syntax:formatpercent (Expression [, Digit [, Leadingdigit [, Paren [, Groupdigit]]]
ARGUMENTS: Ditto.
EXAMPLE: <%=formatpercent (0.45267, 3)%>
result:45.267%

Hour ()
FUNCTION: Returns the number of hours at 24 o'clock.
Syntax:hour (Time)
ARGUMENTS:
EXAMPLE: <%=hour (#4:45:34 pm#)%>
Result:16
(Hour has been converted to 24-hour system)

Instr ()
FUNCTION: Returns the position in which a character or string appears for the first time in another string.
Syntax:instr ([Start,] strtobesearched, strsearchfor [, compare])
Arguments:start is the starting value for the search, strtobesearched the string that accepts the search strsearchfor the character compare to search (see details as



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.