Functions

VBScript Built-in Functions

Categories of Functions

I) Date and Time Functions


1) CDate
Converts a valid date and time expression to the variant of subtype Date
Date Returns the current system date

2) DateAdd
Returns a date to which a specified time interval has been added

3) DateDiff

Returns the number of intervals between two dates

4) DatePart
Returns the specified part of a given date

5) DateSerial
Returns the date for a specified year, month, and day

6) DateValue
Returns a date

7)Day
Returns a number that represents the day of the month (between 1 and 31, inclusive)

8) FormatDateTime
Returns an expression formatted as a date or time

9) Hour
Returns a number that represents the hour of the day (between 0 and 23, inclusive)

10) IsDate
Returns a Boolean value that indicates if the evaluated expression can be converted to a date

11) Minute
Returns a number that represents the minute of the hour (between 0 and 59, inclusive)

12) Month
Returns a number that represents the month of the year (between 1 and 12, inclusive)

13)MonthName
Returns the name of a specified month

14) Now
Returns the current system date and time

15) Second
Returns a number that represents the second of the minute (between 0 and 59, inclusive)

16) Time
Returns the current system time

17) Timer
Returns the number of seconds since 12:00 AM

18)TimeSerial
Returns the time for a specific hour, minute, and second

19)TimeValue
Returns a time

20) Weekday
Returns a number that represents the day of the week (between 1 and 7, inclusive)

21)WeekdayName
Returns the weekday name of a specified day of the week

22) Year
Returns a number that represents the year

23) Date
Returns the current system date

II) Conversion Functions   

1) Asc
Converts the first letter in a string to ANSI code

2) CBool
Converts an expression to a variant of subtype Boolean

3) CByte
Converts an expression to a variant of subtype Byte

4) CCur
Converts an expression to a variant of subtype Currency

5) CDate
Converts a valid date and time expression to the variant of subtype Date

6) CDbl
Converts an expression to a variant of subtype Double

7) Chr
Converts the specified ANSI code to a character

8) CInt
Converts an expression to a variant of subtype Integer

9) CLng
Converts an expression to a variant of subtype Long

10) CSng
Converts an expression to a variant of subtype Single

11) CStr
Converts an expression to a variant of subtype String

12) Hex
Returns the hexadecimal value of a specified number

13) Oct
Returns the octal value of a specified number

III) Format Functions

1) FormatCurrency
Returns an expression formatted as a currency value

2) FormatDateTime
Returns an expression formatted as a date or time

3) FormatNumber
Returns an expression formatted as a number

4) FormatPercent
Returns an expression formatted as a percentage

IV) Math Functions 

1) Abs
Returns the absolute value of a specified number

2) Atn
Returns the arctangent of a specified number

3) Cos
Returns the cosine of a specified number (angle)

4) Exp
Returns e raised to a power

5) Hex
Returns the hexadecimal value of a specified number

6) Int
Returns the integer part of a specified number

7) Fix
Returns the integer part of a specified number

8) Log
Returns the natural logarithm of a specified number

9) Oct
Returns the octal value of a specified number

10) Rnd
Returns a random number less than 1 but greater or equal to 0

11) Sgn
Returns an integer that indicates the sign of a specified number

12) Sin
Returns the sine of a specified number (angle)

13) Sqr
Returns the square root of a specified number

14) Tan
Returns the tangent of a specified number (angle)

15) Round
Rounds a number


V) Array Functions  
 
1) Array
Returns a variant containing an array

2) Filter
Returns a zero-based array that contains a subset of a string array based on a filter criteria

3) IsArray
Returns a Boolean value that indicates whether a specified variable is an array

4) Join
Returns a string that consists of a number of substrings in an array

5) LBound

Returns the smallest subscript for the indicated dimension of an array

6) Split
Returns a zero-based, one-dimensional array that contains a specified number of substrings

7) UBound
Returns the largest subscript for the indicated dimension of an array

VI) String Functions 

1) InStr
Returns the position of the first occurrence of one string within another. The search begins at the first character of the string

2) InStrRev
Returns the position of the first occurrence of one string within another. The search begins at the last character of the string

3) LCase
Converts a specified string to lowercase

4) Left
Returns a specified number of characters from the left side of a string

5) Len
Returns the number of characters in a string

6) LTrim
Removes spaces on the left side of a string

7) RTrim
Removes spaces on the right side of a string

8) Trim

Removes spaces on both the left and the right side of a string

9) Mid
Returns a specified number of characters from a string

10) UCase
Converts a specified string to uppercase

11) Replace
Replaces a specified part of a string with another string a specified number of times

12) Right
Returns a specified number of characters from the right side of a string

13) Space
Returns a string that consists of a specified number of spaces

14) StrComp
Compares two strings and returns a value that represents the result of the comparison

15) String
Returns a string that contains a repeating character of a specified length

16) StrReverse
Reverses a string

VII) I/O Functions


1) InputBox
Displays a dialog box, where the user can write some input and/or click on a button, and returns the contents

2) MsgBox
Displays a message box, waits for the user to click a button, and returns a value that indicates which button the user clicked


VIII) Miscellaneous Functions

1) CreateObject

Creates an object of a specified type

2) Eval
Evaluates an expression and returns the result

3) GetLocale
Returns the current locale ID

4) GetObject
Returns a reference to an automation object from a file

5) GetRef
Allows you to connect a VBScript procedure to a DHTML event on your pages

6) IsEmpty
Returns a Boolean value that indicates whether a specified variable has been initialized or not

7) IsNull
Returns a Boolean value that indicates whether a specified expression contains no valid data (Null)

8) IsNumeric
Returns a Boolean value that indicates whether a specified expression can be evaluated as a number

9) IsObject
 Returns a Boolean value that indicates whether the specified expression is an automation object

10) LoadPicture
Returns a picture object. Available only on 32-bit platforms

11) RGBReturns a number that represents an RGB color value

12) ScriptEngineReturns the scripting language in use

13) ScriptEngineBuildVersion
Returns the build version number of the scripting engine in use

14) ScriptEngineMajorVersion
Returns the major version number of the scripting engine in use

15) ScriptEngineMinorVersion
Returns the minor version number of the scripting engine in use

16) SetLocale
Sets the locale ID and returns the previous locale ID

17) TypeName
Returns the subtype of a specified variable

18) VarType
Returns a value that indicates the subtype of a specified variable
---------------------------------------------------------------------------

1 comments:

Post a Comment