VB functions
This page lists all built-in VBScript functions, which are mainly divided into the following categories:
Date/Time function Conversion function Format function
| Math function Array function
| - ##String function
- Other functions
|
Date/Time function
Function | Description |
---|
CDate | Valid date and time expressions are converted to Date type. |
Date | Returns the current system date. |
DateAdd | Returns the date to which the specified time interval has been added. |
DateDiff | Returns the number of time intervals between two dates. |
DatePart | Returns the specified part of the given date. |
DateSerial | Returns the date of the specified year, month, and day. |
DateValue | Returns the date. |
Day | Returns the number representing the day of the month (between and including 1 to 31). |
FormatDateTime | Returns an expression formatted as a date or time. |
Hour | Returns a number representing the hour of the day (between and including 0 to 23). |
IsDate | Returns a Boolean value indicating whether the calculation expression can be converted to a date. |
Minute | Returns a number representing the minute of the hour (between and including 0 to 59). |
Month | Returns a number representing the month of the year (between and including 1 to 12). |
MonthName | Returns the name of the specified month. |
Now | Returns the current system date and time. |
Second | Returns a number representing the second of the minute (between and including 0 to 59). |
Time | Returns the current system time. |
Timer | Returns the number of seconds since 12:00 AM. |
TimeSerial | Returns the time for a specific hour, minute, and second. |
TimeValue | Returns the time. |
Weekday | Returns a number representing the day of the week (between and including 1 to 7). |
WeekdayName | Returns the weekday name of the specified day of the week. |
Year | Returns a number representing the year. |
Function | Description |
---|
Asc | Convert the first letter in the string to ANSI characters code. |
CBool | Convert the expression to Boolean type. |
CByte | Convert the expression to Byte type. |
CCur | Convert the expression to currency (Currency) type. |
CDate | Convert valid date and time expressions to date (Date) type. |
CDbl | Convert the expression to double precision (Double) type. |
Chr | Convert the specified ANSI character code into characters. |
CInt | Convert the expression to the integer (Integer) type. |
CLng | Convert the expression to long integer (Long) type. |
CSng | Convert the expression to single precision (Single) type. |
CStr | Convert the expression to string type. |
Hex | Returns the hexadecimal value of the specified number. |
Oct | Returns the octal value of the specified number. |
Function | Description |
FormatCurrency | Returns as a currency value formatted expression. |
FormatDateTime | Returns an expression formatted as a date or time. |
FormatNumber | Returns an expression formatted as a number. |
FormatPercent | Returns an expression formatted as a percentage. |
Math function | Top |
Function | Description |
---|
Abs | Returns the absolute value of the specified number. |
Atn | Returns the arc tangent of the specified number. |
Cos | Returns the cosine of the specified number (angle). |
Exp | Returns e (the base of natural logarithms) raised to the power. |
Hex | Returns the hexadecimal value of the specified number. |
Int | Returns the integer part of the specified number. |
Fix | Returns the integer part of the specified number. |
Log | Returns the natural logarithm of the specified number. |
Oct | Returns the octal value of the specified number. |
Rnd | Returns a random number less than 1 but greater than or equal to 0. |
Sgn | Returns an integer that indicates the sign of the specified number. |
Sin | Returns the sine of the specified number (angle). |
Sqr | Returns the square root of the specified number. |
Tan | Returns the tangent of the specified number (angle). |
Function | Description |
---|
Array | Returns a variable containing an array. |
Filter | Returns a zero-based array containing a subset of the string array based on the specified filter criteria. |
IsArray | Returns a Boolean value indicating whether the specified variable is an array. |
Join | Returns a string composed of several substrings in the array. |
LBound | Returns the smallest subscript indicating the dimension of the array. |
Split | Returns a zero-based one-dimensional array containing the specified number of substrings. |
UBound | Returns the maximum subscript indicating the dimension of the array. |
Function | Description |
---|
InStr | Returns the first occurrence of a string in another string s position. The search starts from the first character of the string. |
InStrRev | Returns the position of the first occurrence of a string within another string. The search starts from the last character of the string. |
LCase | Convert the specified string to lowercase. |
Left | Returns the specified number of characters from the left side of the string. |
Len | Returns the number of characters in the string. |
LTrim | Remove spaces on the left side of the string. |
RTrim | Remove spaces on the right side of the string. |
Trim | Remove spaces on the left and right sides of the string. |
Mid | Returns the specified number of characters from a string. |
Replace | Replaces the specified portion of a string with another string a specified number of times. |
Right | Returns the specified number of characters from the right side of the string. |
Space | Returns a string consisting of the specified number of spaces. |
StrComp | Compares two strings and returns a value representing the comparison result. |
String | Returns a string containing repeated characters of the specified length. |
StrReverse | Reverse a string. |
UCase | Convert the specified string to uppercase. |
##Other functions | Top |
Function | Description |
---|
CreateObject | Creates an object of the specified type. |
Eval | Evaluates the expression and returns the result. |
GetLocale | Returns the current locale ID. |
GetObject | Returns a reference to the automation object in the file. |
GetRef | Allows you to connect a VBScript subroutine to a DHTML event on the page. |
InputBox | Displays a dialog box where the user can enter text and/or click a button, and then return the content. |
IsEmpty | Returns a Boolean value indicating whether the specified variable has been initialized. |
IsNull | Returns a Boolean value indicating whether the specified expression contains invalid data (Null). |
IsNumeric | Returns a Boolean value indicating whether the specified expression can be evaluated as a number. |
IsObject | Returns a Boolean value indicating whether the specified expression is an automation object. |
LoadPicture | Returns a picture object. For use on 32-bit platforms only. |
MsgBox | Displays a message box, waits for the user to click a button, and returns a value indicating which button the user clicked. |
RGB | Returns a number representing the RGB color value. |
Round | Rounds the number. |
ScriptEngine | Returns the scripting language in use. |
ScriptEngineBuildVersion | Returns the build number of the script engine in use. |
ScriptEngineMajorVersion | Returns the major version number of the script engine in use. |
ScriptEngineMinorVersion | Returns the minor version number of the script engine in use. |
SetLocale | Set the locale ID and return the previous locale ID. |
TypeName | Returns the subtype of the specified variable. |
VarType | Returns a value indicating the subtype of the variable. |