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