functions: 1, date/time functions. These functions include the display of year, month, day, hour, minute, second and week. (1)Now function: according to the date and time set by the computer system, return the current date and time value. Use method now (); (2)Date function: only the date value set by the current computer system is returned. Usage: date (); (3)Time function: only the time value set by the current computer system is returned. Usage: time (); (4)Year function: returns an integer representing a year. Usage: year(date), where the date parameter is any parameter that can represent the date. For example, "year(date ())" means that the integer of "year" is extracted from the date (). In addition, it can also be applied as follows: "year(#5 2,26#)" means to extract the integer value of "year" in "May 2th, 26". "5 2,26" can also be expressed in the forms of "5-2-26" and "5/2/26", that is, the combination of "a certain day of a certain month" and "a certain year". Also note that "#" is used for inclusion to indicate the date value. (5)Month function: returns an integer value between 1 and 12, representing a month of the year. Usage: month(date). The description of the parameter date is the same as that of the year function. But pay attention to the correctness of the date, such as "#13-31-26#", there is no "13" month at all, which must be wrong. (6)Day function: returns an integer value between 1 and 31, representing a day in a month. Usage: day(date). The description of the parameter date is the same as that of the year function. Also pay attention to the correctness of the date. For example, the "3th" day defined for "February" in "#2-3-26#" is wrong. (7)Hour function: returns an integer value between and 23, representing an hour in a day. Usage: hour(time). Where the parameter time is an arbitrary expression that can represent time. For example, "hour(time ())" means that the integer of "hour" is extracted from the time obtained from "time ()". Similarly, the parameter time can also use "hour(#11:45:5#)" to indicate that the current hours are extracted from "45" minutes and "5" seconds at "11". Of course, the defined time should conform to the norms of time. (8)Minute function: returns an integer value between and 59, representing a minute in an hour. Usage: minute(time). The description of the time parameter is the same as that of the hour function. (9)Second function: returns an integer value between and 59, representing a second in a minute. Usage: second(time). The description of the time parameter is the same as that of the hour function. (1)Weekday function: Returns an integer of a day in a week. Usage: weekday(date). The description of the parameter date is the same as that of the year function. The return values of this function are "1" to "7", representing "Sunday", "Monday" ... and "Saturday" respectively. For example, when the return value is "4", it means "Wednesday". (11)WeekDayName function: returns the string of a specific day in a week. Compared with the weekday function, it translates "day of the week", and the usage method: weekdayname(weekday). The parameter weekday is the value of a specific day of the week. For example, "weekdayname(weekday(date ())" means what day it is. Because "date ()" means the current time, and "weekday(date ())" means an integer of a specific day of the week. Of course, the string content finally displayed by the weekdayname function is also related to the current operating system language family. For example, the Chinese operating system will display Chinese characters such as "Monday", while the English operating system will display "mon" (short Mon”(Monday). In addition, there are some calculation functions about time interval in VBScript: (1)DateAdd function: return the date and time of the specified time interval. You can calculate how many years apart, or months apart, or hours apart, and so on. Usage: dateadd(interval, number, date). Where the parameter interval indicates the time interval unit to be added. It is expressed in the form of character strings, such as "yyyy" for years, "q" for quarters, "m" for months, "d" for days, "ww" for weeks, "h" for hours, "n" for minutes and "s" for seconds. And the parameter number indicates the number of added time intervals. It is expressed in numerical form and can be negative. The parameter date should be in the correct format of date and time. For example, dateadd ("d", 1, "May 2, 26") means the date value of 1 days after May 2, 26: August 28, 26. Another example is dateadd ("h",-12, "25-5-2 1: : "), which means the date and time of 12 hours before 1: am on May 2, 25: 22: : on May 19, 25. (2)DateDiff function: returns the interval between two dates and times. You can calculate the age, hours and so on between two dates. Usage: datediff(interval,date1,date2). The description of the interval parameter in the parameter interval and dateadd function is the same, and the date1 and date2 parameters are the two dates and times that are compared with each other. In addition, when the date time value of date1 is greater than date2, it will be displayed as a negative value. For example, datediff ("yyyy", "July 18th, 1982", date) indicates how many years have passed since someone was born. Another example is DateDiff ("D", "July 18th, 1982", "July 18th, 262"), which calculates how many days have passed in 8 years: 2922. 2, string processing function in the script function processing, usually need to do some decorative processing on some strings. For example, filtering out sensitive words in strings to meet the requirements of final display; Another example is when a long string needs to extract the first few characters. (1)Asc function: returns the ANSI character code corresponding to the first letter in the string. Usage: asc(string). Where the string parameter represents a string. (2)Chr function: returns the character corresponding to the specified ANSI character code. Usage: chr(chrcode). Parameter chrcode is the relevant identification number. The function of this function corresponds to asc function. For example: ASC ("a") stands for the ANSI character "97" of lowercase letter "a"; Similarly, chr(97) stands for "lowercase letter A". In addition, when the value of the parameter chrcode in chr(chrcode) is a number from to 31, it means an unprintable ASCII code. For example, "chr(1)" stands for line feed and "chr(13)" stands for carriage return, which is often used in the conversion of input and display formats. (3)Len function: Returns the number of characters (bytes) in a string. Usage: len(string). For example, the value of len ("love") is 4. (4)LCase function: Returns lowercase forms of all strings. Usage: lcase(string). For example, lcase(“WEBJXCOM ") returns as" webjxcom ". (5)UCase function: Returns the uppercase form of all strings. Corresponding to lcase function. Similarly, ucase ("WEBJX") is returned as "webjx". (6)Trim function, LTrim function and RTrim function: return string contents without spaces before and after, without spaces before or after, respectively. For example: trim(“ 1234567 ") is returned as" 1234567 ",with no spaces in the leading and trailing parts; The ltrim(“ 1234567 ") is returned as" 1234567 "with no leading space; Rtrim(“ 1234567 ") is returned as" 1234567 ",followed by no spaces; This function is often used in registration information, such as ensuring the spaces before or after the registered user name. (7)Left function: Returns a specified number of characters from the left of the string. Usage: left(string,length). For example, left ("brousce", 5) is returned as "Brous", that is, the first five characters. (8)Right function: Returns a specified number of characters from the left of the string. Usage: right(string,length). For example, right ("Brousce", 4) is returned as "usce", that is, the last four characters. (9)instr function: Returns the position where a string first appears in another string. For example, to find the position where the letter "a" first appears in the string "A11B121C19D1861", you can use instr (my _ string, "A11B121C19D1861") (1) mid function: return a specified number of characters from the string. For example, the current "11" should take the value of three units from the second bit of the string "A11B121C119D1861": mid ("A11B121C119D1861", 2,3) (11) replace function: find and replace the specified string in the string. Replace (strtobeseached, strychforwith) where strtobeseached is a string, strychforis a substring to be searched, and strreplacewith is a substring to be replaced. For example, replace (rscon, "<" ,"<" ) means that all "<" in rscon will be Replace the character of with "<". 3, Type conversion function Cbool(string) is converted to boolean value Cbyte(string) is converted to byte value Ccur(string) is converted to currency value Cdate(string) is converted to previous type value
Cdbl(string) is converted to double precision value Cint(string) is converted to integer value Clng(string). The value Csng(string) converted into a long integer is converted into a single-precision value Cstr(var) into a string value Str(var), the numerical value is converted into a string Val(string), and the string is converted into a numerical value 4. The arithmetic function Abs(nmb) returns the absolute value Atn(nmb) of the numerator, the arctangent Cos(nmb) of a number, the remainder Exp(nmb) of an angle, the power value Int(nmb) of the natural index, the shaping (carry) part Fix(nmb) of a number, and the shaping (rounding) part Formatpercent (expression) of a number. Return percentage Hex(nmb) Returns hexadecimal number Log(nmb) Returns natural logarithm Oct(nmb) Returns octal number Rnd Returns random number greater than "" and less than "1". However, before that, random seed Sgn(nmb) should be generated by randomize statement to judge the positive value Sqr(nmb) of the return angle of the sign Sin(nmb) of a number, the quadratic root Tan(nmb) of a number and the tangent value 5 of a number. Other functions IsArray(var) judge whether a variable is array IsDate(var) judge whether a variable is date IsNull(var) judge whether a variable is empty IsNumeric(var) judge whether an expression contains value IsObject(var) judge whether a variable is object TypeName(var). Returns the data type of the variable Array(list) returns the array Split(liststr) returns a one-dimensional array LBound(arrayP) from a list string, and returns the minimum index Ubound(array) and the maximum index CreateObject(class) of the array. Create an object GetObject(pathfilename) to get the file object: 1. Request
The request object saves customer information in several collections for ASP applications. The general access method is: request. collection ("member")
When you don't specify a collection name, search all the collections in the order of (1) query string, (2) form, (3) cookie and (4)ServerVariable
. When the first matching variable is found, it is determined that it is the member to be referenced. Of course, in order to improve efficiency, you'd better explicitly specify that you are a member of that set.
QueryString collection
when an HTML form uses the GET method to pass data to an ASP file, the data is saved in the collection QueryString. Its members can have multiple values related to it, that is, multiple elements in the same form can have the same name. The following code accesses these data:
<; %For each item in Request.QueryString("Name")
Response.write Item & "< br>"
Next %>
Form collection
when the Form uses the POST method, the data is saved in the form collection.
the p>ServerVariable collection
stores the information of the HTTP header transmitted with the HTTP request, which can be accessed through the.