ASP function syntax quick query table

Source: Internet
Author: User
Tags first string month name rtrim

VBScript Functions

Function Description

Example


ABS (numerical value)
Absolute value. The absolute value of a number is its positive value. The absolute value of a null string. Uninitialized variable, which is absolutely 0 Example: ABS (-2000)

Result: 2000
Array (array elements separated by commas) The array function returns the value of an array element. Example:

A = array (1, 2, 3)

B = a (2)

Result: 2

Note: Variable B is the value of the second element of array.
ASC (string) Converts the first letter of a string to an ANSI (American National Standard) character. Example: ASC ("Internet ")

Result: 73

Description: displays the ANSI code of the first letter I.
Cbool (expression) Convert to a Boolean logical value variable type (true or false) Example: cbool (1 + 2)

Result: True.
Cdate (date expression) Change to date variable type. You can use the isdate function to determine whether the data can be converted to a date. Example: cdate (now () + 2)

Result: 10:30:59
Cdbl (expression) Convert to double variable type.
CHR (ANSI code) Converts an ascii code to a character. Example: CHR (72)

Result: H
CINT (expression) Convert to an integer variable type. Example: CINT ("3.12 ")

Result: 3
Clng (expression) Convert to long variable type.
Csng) Convert to single variable type.
CSTR (expression) Convert to string variable type.
Date () Top Returns the date of the system. Example: Date

Result: 2000/5/13
Dateadd (I, n, d) Add a date to the date after a period. I: Set the unit of a period added by a date. For example, interval = "D" indicates that the unit of N is day. I is set as follows:

Yyyy Year

Q quarter

M month

D Day

W weekday

H hour

N minute points

S second seconds

N: a numeric expression that specifies the period of a date. It can be a positive or negative value. A positive value indicates a plus (the result is a date after date ), negative value indicates subtraction (Result:> date before date ).

D: Date to be added or subtracted.
Example: dateadd ("M", 1, "31-Jan-98 ")

Result: 28-feb-98

Note: if the date is 31-Jan-98 plus one month, the result is 28-feb-98 rather than 31-fe-98.

Example: dateadd ("D", 20, "30-Jan-99 ")

Result:

Note: Add a date of 30-Jan-99 plus a date of 20 days.
Datediff (I, D1, D2 [, FW [, FY]) Calculates the period between two dates.

I: Set the unit of Period Calculation between two dates. For example, I = "M" indicates that the unit of calculation is month. > The Set Value of I is as follows:

Yyyy> year

Q quarter

M month

D Day

W weekday

H hour

M minute

S second seconds

D1, D2: Two date expressions in the calculation period. If> date1 is earlier, the period result between two dates is positive. If> date2 is earlier, the result is negative.

FW: set the first day of each week to the day of the week. If not set, it indicates Sunday. > The FW settings are as follows:

0 usage> API setting value.

1 Sunday

2 Monday

3 Tuesday

4. Wednesday

Friday

6 Friday

7. Saturday

FY: set the first week of the year. If not specified, the week of January 1, January 1 is the first week of the year. > The FY value is as follows:

0 usage> API setting value.

1. The week of January 1, January 1 is the first week of the year.

2. The first week of at least four days is the first week of a year.

3. the first week of the seventh day is the first week of the year.
Example: datediff ("D", "25-Mar-99", "30-jun-99 ")

Result: 97

Note: The period between two dates is 97 days.
Datepart (I, d, [, FW [, FY]) Returns the part of a date.

> I: Set the part to be returned. For example,> I = "D" indicates that the return part is a day. > I is set as follows:

Yyyy Year

Q quarter

M month

D Day

W weekday

H hour

M minute

S second seconds

D: Date to be calculated.

> Fw: Specifies the day of the week on the first day of the week. If not specified, it indicates Sunday. > The FW settings are as follows:

0 usage> API setting value.

1 Sunday

2 Monday> 3 Tuesday

4. Wednesday

Friday

6 Friday

7. Saturday

FY: set the first week of the year. If not specified, the week of January 1, January 1 is the first week of the year. > The FY value is as follows:

0 usage> API setting value.

1. The week of January 1, January 1 is the first week of the year.

2. The first week of at least four days is the first week of a year.

3. the first week of the seventh day is the first week of the year.
Example: datepart ("M", "25-Mar-99 ")

Result: 3

Description: displays the monthly part of a date.
Dateserial (year, month, day) Convert (year, month, day) to the date variable type. Example: dateserial (99,10, 1)

Result:
Datevalue (string or expression of a date) Convert to date variable type, date from January 1,100 to December. The format is month, day, and year or month/day/year. For example: December 30,1999, Dec 30,1999, 12/30/1999, 12/30/99 Example: datevalue ("January ")

Result: 2002/1/1
Day (string or expression of the date) Returns the "day" part of the date. Example: Day ("12/1/1999 ")

Result: 1
Fix (expression) Top Converts a string to an integer number. Same as int function. If it is null, null is returned.

The difference between int (number) and fix (number) is negative. For example, INT (-5.6) =-6, fix (-5.6) =-5.
Example: fix (5.6)

Result: 5
Hex (expression) Top Returns the hexadecimal value of a value. If the expression is null, Hex (expression) = NULL. If the expression is empty, Hex (expression) = 0. "& H" can be added to the hexadecimal notation. For example, "16-digit" & H10 "indicates the hexadecimal notation of 16. Example: Hex (30)

Result: 1e
Hour (Time string or expression) Returns the "Hour" part of the time. Example: hour ("12:30:54 ")

Result: 12
Instr ([start,] string1, string2 [, compare]) Top Compares a string from left to right with another string and returns the first string at the same position.

Start indicates the number of characters to be compared. If start is omitted, start indicates the first word to be compared. string1 indicates the string expression to be searched, and string2 indicates the string expression to be compared, compare is the comparison method, compare = 0 table binary comparison method, compare = 1 Table text comparison method, if compare is omitted, It is the preset binary comparison method.
Example: instr ("abc123def123", "12 ")

Result: 4
Limit Rev ([start,] string1, string2 [, compare]) Compare a string from the right to the left to the other, and return the first same position.

Start indicates the number of characters to be compared. If start is omitted, start indicates the first word to be compared. string1 indicates the string expression to be searched, and string2 indicates the string expression to be compared, compare is the comparison method, compare = 0 table binary comparison method, compare = 1 Table text comparison method, if compare is omitted, It is the preset binary comparison method.
Example: Rev ("abc123def123", "12 ")

Result: 10
INT (expression) Returns the integer part of a value. Same as the fix function. Example: int (5.6)

Result: 5
Isarray (variable) The test variable is (true) No (false) is an array. Example: isarray (3)

Result: false.

Note: It is not an array.
Isdate (Expression of date or string) Whether it can be converted to a date. The date ranges from January 1,100 A.D. to December A.D. Example: isdate ("December 31,1999 ")

Result: True.

Description: It can be converted to a date.
Isempty (variable) The test variable is (true) No (false) initialized. Example: isempty ()

Result: True.
Isnull (variable) The test variable is (true) No (false) not valid data. Example: isnull ("")

Result: false.

Description: valid data.
Isnumeric (expression) Yes (true) No (false) is a number. Example: isnumeric ("ABC123 ")

Result: false.

Note: It is not a number.
Lcase (string expression) Top Converts a string to lowercase. Converts the uppercase letters to lowercase letters. The rest of the string remains unchanged. Example: lcase ("ABC123 ")

Result: ABC123
Left (string expression, length) The number of characters on the left of the string. Length is a word. The LEN function can tell the length of the string. Example: Left ("ABC123", 3)

Result: ABC
Len (string expression variable) Returns the length of a string. Example: Len ("ABC123 ")

Result: 6
Ltrim (string expression) Removes the white space on the left of the string. Rtrim removes the white space on the right of the string, and the trim function removes the white space on both sides of the string. Example: ltrim ("456 +" ABC ")

Result: 456abc123
Mid (string expression, start [, length]) Top The number of characters in the string. Start is the number of characters starting from, and length is the number of words. If the length is slightly greater, it is obtained from start to the rightmost bottom. The LEN function can tell the length of the string. Example: Mid ("ABC123", 2, 3)

Result: C12
Minute (date string or expression) Returns the "Minute" part of the time. Example: minute ("12:30:54 ")

Result: 30
Month (string or expression of the date) Returns the month of the date. Example: Month ("12/1/2001 ")

Result: 12
Monthname (month [, abbreviate]) Returns the name of the month.

Month: Number 1 ~ 12. For example, 1 represents January, and 7 represents July.

Abbreviate: Yes (true) No (false) is short for March, or mar. The default value is false. The Chinese month name has no abbreviation.
Example: monthname (7)

Result: February 1, July
Now () Returns the date and time of the system. Example: Now ()

Result: 10:35:59 AM
Oct () Returns the octal value of a value. "& O" can be added to carry 8. For example, carry 8 & o10 represents the decimal 8. Example: Oct (10)

Result: 12
Replace (string expression, findnreplacewith [, start [, Count [, compare]) Replace a character string with some characters. Search for the original string to be replaced (FIND). If it is found, it is replaced with the new string (replacewith ).

Find: the original string to be replaced.

Replacewith: The replaced word.

Start: Search for replacement from the first word. If not specified, search for replacement from the first word.

Count: the number of replacement times. If not specified, all searched strings replace character strings.

Compare: The comparison method. Compare = 0 indicates the binary comparison method, compare = 1 Table text comparison method, and compare = 2 table depends on the Data Type of the comparison, if compare is omitted, the default binary comparison method is used.
Example: Replace ("abcd123abc", "AB", "AB ")

Result: abcd123abc
Right (string expression, length) The number of characters on the right of the string, and the length is the number of characters. The LEN function can tell the length of the string. Example: Right ("ABC123", 3)

Result: 123
RND [(number)] 0 ~ A random value of 1. Number is any valid numeric expression. If the number is smaller than 0, the same random value is obtained each time. If the number is greater than 0 or is not provided, the next random value is obtained in sequence. > Number = 0 indicates obtaining the most recent random value. To avoid the same random number order, you can add randomize before the RND function. Example: RND

Result: 0.498498
Round (numeric expression [, d]) Rounding.

D: number of decimal places rounded to. If not, rounded to an integer.
Example: round (30635,1)

Result: 3.6
Rtrim (string expression) Removes the white space on the right of the string. Ltrim removes the white space on the left side of the string. The trim function removes the white space on both sides of the string. Example: rtrim ("ABC123") + "456"

Result: abc123456
Second (Time string or expression) Top Returns the second part of the time. Example: Second ("12:30:54 ")

Result: 54
Space (repeated times) Returns the same blank string. Example: A "+ space (5) +" B

Result: A B

Note: Five blank words are added between A and B.
String (number of repetitions, the word to be repeated) Returns the same string. Example: string (5, 71)

Result: ggggg
Strreverse (string (10, 71 )) Returns a string in reverse order. Example: strreverse ("ABC ")

Result: CBA
Time () The time when the system is returned. Example: Time

Result: 10:35:59
Timeserial (hour, minute, second) Convert the specified (hour, minute, second) to the time variable type. Example: timeserial (10, 31, 59)

Result: 10:31:59
Timevalue (date string or expression) Convert to the time variable type. The string or expression of the date from 0:00:00 (12:00:00 a.m.) to 23:59:59 (11:59:59 p.m .). Example: timevalue ("11:59:59 ")

Result: 11:59:59
Trim (string expression) Removes the spaces on both sides of the string. Example: trim ("ABC123 ")

Result: ABC123
Ucase () Top Converts a string to uppercase. Converts the lower-case letters to uppercase, and the rest of the string remains unchanged. Example: ucase ("ABC123 ")

Result: ABC123
Vartype (variable) Returns a variable type. Same as the typename function, vartype returns the code of the variable type, and typename returns the name of the variable type. Example: vartype ("I love you! ")

Result: 8
Weekday (date expression, [FW]) Returns the number of a week.

FW: set the first day of a week to the day of a week. If this parameter is omitted, table 1 (Sunday) is displayed ).

Firstdayfweek is set to: 1 (Sunday), 2 (Monday), 3 (Tuesday), 4 (Wednesday), 5 (Thursday), 6 (Friday), and 7 (Saturday ).
Example: weekday ("1/1/2000 ")

Result: 7
Weekdayname (W, A, Fw) Returns the name of the day of the week.

W: Yes (true) No (false) is the abbreviation. For example, march is abbreviated as Mar. The default value is false. The day of the week in Chinese is not abbreviated.

FW: set the first day of a week to the day of a week. If table 1 (Sunday) is omitted ). Specifies the name of the day of the week to be returned, which is the day of the week.

A: 1 (Sunday), 2 (Monday), 3 (Tuesday), 4 (Wednesday), 5 (Thursday), 6 (Friday), 7 (Saturday ).
Example: weekdayname ("1/1/2000 ")

Result: Saturday
Year () Returns the year of the date. Example: year ("12/1/2000 ")

Result: 2000
Related Article

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.