Reference materials: ASP functions organize commonly used strings, data and other operation functions under Asp, which are often encountered in daily operations.
1. Function array()
Function: Create an array variable
Format: array(list)
Parameter: list is each numeric column in the array variable, with commas intervals in the middle
example:
Result: i is assigned as an array
2. Function Cint()
Function: Convert an expression/other type of variable into an integer type (int)
Format: Cint(expression)
Parameters: expression is any valid expression/other type variable
example:
Results: 236
The function Cint() converts the character "234" into an integer 234. If the expression is empty or invalid, the return value is 0;
3. Function: Creatobject()
Function: Create and return an ActiveX object.
Format: Creatobject(obname)
Parameter:obname is the name of the object
example:
result:
4. Function Cstr()
Function: Convert an expression/other type of variable into a character type (string)
Format: Cstr(expression)
Parameters: expression is any valid expression/other type variable
example:
Result: The function Cstr() converts the integer 5 into the character "5".
5. Function Date()
Function: Return the date of the current system (server side)
Format: Date()
Parameters: None
example:
Results: 05/10/00
6. Function Dateadd()
Function: Calculate a specified time and
Format: dateadd(timeinterval,number,date)
Parameters: timeinterval is the time unit (month, day...); number is the time interval value, and date is the time starting point.
example:
result:
11/4/99
3:34:45PM
in
"m"="month";
"d"="day";
If it is currentDate format, then
"h"="hour";
"s"="second";
7. Function Datediff()
Function: Calculate a specified time difference of a certain quantity
Format: datediff(timeinterval,date1,date2[,firstdayofweek[,firstdayofyear]])
Parameters: timeinterval is the time unit; date1 and date2 are valid date expressions, firstdayofweek, firstdayofyear are any options.
example:
Results: Thereare150daystomilleniumfrom8/4/99.
8. Function day()
Function: Return an integer value corresponding to a day of a certain month
Format: day(date)
Parameters: date is a valid date expression;
example:
Results: 4
9. Function formatcurrency()
Function: Convert to currency format
Format: formatcurrency(expression[,digit[,leadingdigit[,paren[,groupdigit]]]])
Parameters: expression is a valid numeric expression; digit represents the number of digits after the decimal point; leadingdigit, paren, groupdigit are any options.
example:
Result: $34.35
10. Function Formatdatetime()
Function: Format date expression/variable
Format: formatdatetime(date[,nameformat])
Parameters: date is a valid date expression/variable; nameformat is the specified date format constant name.
example:
Results: Wednesday, August 04, 1999
11. Function formatnumber()